Record merge progress durably and finish pushed merges at startup

This commit is contained in:
Ian Gulliver
2026-10-16 13:01:17 -07:00
parent 51dfbf78a0
commit d9e0498d10
6 changed files with 211 additions and 42 deletions
+6 -1
View File
@@ -251,8 +251,13 @@ func FastForward(repo, rev string) error {
return err
}
func FetchFastForward(repo, branch string) error {
func Fetch(repo string) error {
_, err := run(repo, "fetch", Remote)
return err
}
func FetchFastForward(repo, branch string) error {
err := Fetch(repo)
if err != nil {
return err
}
+18 -2
View File
@@ -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
}