mirror of
https://github.com/go-gitea/gitea.git
synced 2025-10-13 04:06:06 +00:00
Backport #33597 by @ericLemanissier follows-upbe4e961240
This is the same modification asbe4e961240
but for force-pushes. It is needed, because `git fetch` reveals force pushes for github mirrors: ``` $ git fetch --tags origin remote: Enumerating objects: 22, done. remote: Counting objects: 100% (22/22), done. remote: Compressing objects: 100% (4/4), done. remote: Total 9 (delta 5), reused 8 (delta 5), pack-reused 0 (from 0) Unpacking objects: 100% (9/9), 1.70 KiB | 12.00 KiB/s, done. From https://github.com/conan-io/conan-center-index 729f0f1b8f..48184eddeb refs/pull/26595/head -> refs/pull/26595/head + 0c31ab60a3...1283cca9e7 refs/pull/26595/merge -> refs/pull/26595/merge (forced update) ``` Fix https://github.com/go-gitea/gitea/issues/33200 PS: I did not test the modification, but it is the exact same change as the last hunk in https://github.com/go-gitea/gitea/pull/33224/files#diff-bb5cdb90db0f0e7f6716c0e6d0b9cbb67f08d82052b03ab3a7b5e23a1d76aed7 , just moved to the previous case of the switch Co-authored-by: ericLemanissier <ericLemanissier@users.noreply.github.com>
This commit is contained in:
@@ -136,7 +136,9 @@ func parseRemoteUpdateOutput(output, remoteName string) []*mirrorSyncResult {
|
||||
case strings.HasPrefix(lines[i], " - "): // Delete reference
|
||||
isTag := !strings.HasPrefix(refName, remoteName+"/")
|
||||
var refFullName git.RefName
|
||||
if isTag {
|
||||
if strings.HasPrefix(refName, "refs/") {
|
||||
refFullName = git.RefName(refName)
|
||||
} else if isTag {
|
||||
refFullName = git.RefNameFromTag(refName)
|
||||
} else {
|
||||
refFullName = git.RefNameFromBranch(strings.TrimPrefix(refName, remoteName+"/"))
|
||||
@@ -159,8 +161,15 @@ func parseRemoteUpdateOutput(output, remoteName string) []*mirrorSyncResult {
|
||||
log.Error("Expect two SHAs but not what found: %q", lines[i])
|
||||
continue
|
||||
}
|
||||
var refFullName git.RefName
|
||||
if strings.HasPrefix(refName, "refs/") {
|
||||
refFullName = git.RefName(refName)
|
||||
} else {
|
||||
refFullName = git.RefNameFromBranch(strings.TrimPrefix(refName, remoteName+"/"))
|
||||
}
|
||||
|
||||
results = append(results, &mirrorSyncResult{
|
||||
refName: git.RefNameFromBranch(strings.TrimPrefix(refName, remoteName+"/")),
|
||||
refName: refFullName,
|
||||
oldCommitID: shas[0],
|
||||
newCommitID: shas[1],
|
||||
})
|
||||
|
Reference in New Issue
Block a user