|
|
@ -87,6 +87,7 @@ type mirrorSyncResult struct {
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
// * [new tag] v0.1.8 -> v0.1.8
|
|
|
|
// * [new tag] v0.1.8 -> v0.1.8
|
|
|
|
// * [new branch] master -> origin/master
|
|
|
|
// * [new branch] master -> origin/master
|
|
|
|
|
|
|
|
// * [new ref] refs/pull/2/head -> refs/pull/2/head"
|
|
|
|
// - [deleted] (none) -> origin/test // delete a branch
|
|
|
|
// - [deleted] (none) -> origin/test // delete a branch
|
|
|
|
// - [deleted] (none) -> 1 // delete a tag
|
|
|
|
// - [deleted] (none) -> 1 // delete a tag
|
|
|
|
// 957a993..a87ba5f test -> origin/test
|
|
|
|
// 957a993..a87ba5f test -> origin/test
|
|
|
@ -117,6 +118,11 @@ func parseRemoteUpdateOutput(output, remoteName string) []*mirrorSyncResult {
|
|
|
|
refName: git.RefNameFromBranch(refName),
|
|
|
|
refName: git.RefNameFromBranch(refName),
|
|
|
|
oldCommitID: gitShortEmptySha,
|
|
|
|
oldCommitID: gitShortEmptySha,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
case strings.HasPrefix(lines[i], " * [new ref]"): // new reference
|
|
|
|
|
|
|
|
results = append(results, &mirrorSyncResult{
|
|
|
|
|
|
|
|
refName: git.RefName(refName),
|
|
|
|
|
|
|
|
oldCommitID: gitShortEmptySha,
|
|
|
|
|
|
|
|
})
|
|
|
|
case strings.HasPrefix(lines[i], " - "): // Delete reference
|
|
|
|
case strings.HasPrefix(lines[i], " - "): // Delete reference
|
|
|
|
isTag := !strings.HasPrefix(refName, remoteName+"/")
|
|
|
|
isTag := !strings.HasPrefix(refName, remoteName+"/")
|
|
|
|
var refFullName git.RefName
|
|
|
|
var refFullName git.RefName
|
|
|
@ -159,8 +165,15 @@ func parseRemoteUpdateOutput(output, remoteName string) []*mirrorSyncResult {
|
|
|
|
log.Error("Expect two SHAs but not what found: %q", lines[i])
|
|
|
|
log.Error("Expect two SHAs but not what found: %q", lines[i])
|
|
|
|
continue
|
|
|
|
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{
|
|
|
|
results = append(results, &mirrorSyncResult{
|
|
|
|
refName: git.RefNameFromBranch(strings.TrimPrefix(refName, remoteName+"/")),
|
|
|
|
refName: refFullName,
|
|
|
|
oldCommitID: shas[0],
|
|
|
|
oldCommitID: shas[0],
|
|
|
|
newCommitID: shas[1],
|
|
|
|
newCommitID: shas[1],
|
|
|
|
})
|
|
|
|
})
|
|
|
|