Record merge progress durably and finish pushed merges at startup
This commit is contained in:
+18
-2
@@ -69,7 +69,23 @@ func NoteCommit(repo, commit, note string, env []string) (string, error) {
|
||||
return runEnv(repo, env, append(commitArgs, tree)...)
|
||||
}
|
||||
|
||||
func SetNotes(repo, notes string) error {
|
||||
_, err := run(repo, "update-ref", NotesRef, notes)
|
||||
func AdvanceNotes(repo, notes string) error {
|
||||
current, stderr, code, err := runCode(repo, nil, "rev-parse", "--verify", "--quiet", NotesRef)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if code != 0 && code != 1 {
|
||||
return fmt.Errorf("git rev-parse %s: exit status %d: %s", NotesRef, code, stderr)
|
||||
}
|
||||
if code == 0 {
|
||||
contained, err := IsAncestor(repo, notes, current)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if contained {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
_, err = run(repo, "update-ref", NotesRef, notes)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user