git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] rerere: keep a background gc from killing a rebase

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 5, 2026, 16:10 UTC
Message-ID
<xmqqwlsz65mu.fsf@gitster.g>
In-Reply-To
<CAA0xjtqF_60kKC_B=-=AkBSG0ZiFd_uSjzCZ4Bup8Pvg1_uALQ@mail.gmail.com>
Thomas Bachem <mail@thomasbachem.com> writes:
Show 7 quoted lines
>> Perhaps it is just the way the above three lines is stated and what
>> the code actually does may not be problematic, but I am not sure if
>> that is what the latter half of the above sentence is trying to say.
>
> No, it's what the code does. Once the timeout is up, the conflicted
> step goes on without recording the preimage, and the resolution the
> user makes after that is lost, as you say.

It is a hard-to-accept regression without a good justification, though, especially with the other efforts to tame "rerere gc" from hogging the lock too often going on.

If you have a 100-commit "rebase" that is interrupted in the middle, say at commit #70, at worst you should be able to hard reset and abort it, and then restart it starting on top of the result of applying up to commit #69 (with "rebase --onto") to finish the rest, so failing in the middle is not like throwing the effort you made so far away.

Show 8 quoted lines
> A gc that outlasts the timeout still stops the rebase where it does
> today. With the gc giving way whenever it comes second and the
> sequencer series keeping a rebase's own commits from starting one,
> that should be rare. Whoever would rather wait it out can set
> rerere.lockTimeout to -1, but I'd keep the default finite so a lock
> left behind by a crash fails like every other lock instead of
> hanging. Writing the stop state before rerere runs would let such a
> rebase continue, which I can look at separately.

Stepping back a bit, what does a "conflicted step goes on without recording the preimage" exactly look like? "git rebase" goes on chugging, and hits a commit that does not cleanly apply. It leaves a conflict and in a normal case immediately before returning the control back to the user, its "git rerere" invocation creates a preimage. Even if we make "git rerere" fail to do so, it would not be unrecoverable. The end user has control at that point, and it is not like the rest of rebase goes on without giving a chance to the user to intervene and recover.

Would it make sense to LOUDLY tell the user when "git rerere" fails to do what the user expects to do? The output at the point of time on the terminal would end with something like

    CONFLICT (content): Merge conflict in t/t0123-frotz.sh
    Auto-merging nitfol.c
    error: could not apply 8c7b68a8bf... nitfol: remove frotz
    Recorded preimage for 't/t0123-frotz.sh'
    Could not apply 8c7b68a8bf... # nitfol: remove frotz
if "git rerere" kicked in correctly, so if we said
    CONFLICT (content): Merge conflict in t/t0123-frotz.sh
    Auto-merging nitfol.c
    error: could not apply 8c7b68a8bf... nitfol: remove frotz
    FAILED TO RECORD PREIMAGE FOR 't/t0123-frotz.sh'
    Could not apply 8c7b68a8bf... # nitfol: remove frotz
    *** RUN "git rerere" MANUALLY BEFORE DOING ANYTHING ELSE ***
    *** IF YOU DO NOT WANT TO MAKE YOUR EFFORT IN RESOLVING ***
    *** THIS CONFLICT WASTED ***
or something similar, would that help the user?

I do not expect the "silent failure" to run "rerere" would not be followed by automated applications of many subsequent commits that makes it too late when the user notices what happened. An attempt to invoke "rerere" will always be followed by a stopped automation and the user will have the control at that point. So in that sense, as long as the user is told clearly that some step that usually happens and the user has learned to rely on did *not* happen, and also told how to recover from the failure, it is not too bad.

Thanks.
Previous: Thomas BachemNext: Thomas Bachem
Message 19 of 39 in “rerere: keep a background gc from killing a rebase”
  1. rerere: keep a background gc from killing a rebaseThomas Bachem via GitGitGadget, Sep 2, 2026
  2. Phillip WoodSep 2, 2026
  3. Thomas BachemSep 2, 2026
  4. Phillip WoodSep 3, 2026
  5. Patrick SteinhardtSep 3, 2026
  6. Thomas BachemSep 3, 2026
  7. Patrick SteinhardtSep 3, 2026
  8. Thomas BachemSep 3, 2026
  9. Phillip WoodSep 3, 2026
  10. rerere: keep a background gc from killing a rebaseThomas Bachem via GitGitGadget, Sep 4, 2026
  11. Phillip WoodSep 4, 2026
  12. Thomas BachemSep 4, 2026
  13. Phillip WoodSep 7, 2026
  14. Junio C HamanoSep 4, 2026
  15. Thomas BachemSep 4, 2026
  16. rerere: keep a background gc from killing a rebaseThomas Bachem via GitGitGadget, Sep 4, 2026
  17. Junio C HamanoSep 4, 2026
  18. Thomas BachemSep 5, 2026
  19. Junio C HamanoSep 5, 2026
  20. Thomas BachemSep 6, 2026
  21. Patrick SteinhardtSep 7, 2026
  22. 0/2 rerere: wait for MERGE_RR.lock, and go on at a conflictThomas Bachem via GitGitGadget, Sep 14, 2026
  23. 1/2 rerere: wait for MERGE_RR.lock, and let the gc skip itThomas Bachem via GitGitGadget, Sep 14, 2026
  24. Patrick SteinhardtSep 28, 2026
  25. 2/2 rerere: go on at a conflict when the lock stays busyThomas Bachem via GitGitGadget, Sep 14, 2026
  26. Patrick SteinhardtSep 28, 2026
  27. 0/3 rerere: wait for MERGE_RR.lock, and go on at a conflictThomas Bachem via GitGitGadget, Sep 28, 2026
  28. 1/3 rerere: wait for MERGE_RR.lock before giving upThomas Bachem via GitGitGadget, Sep 28, 2026
  29. 2/3 rerere: add "gc --auto" that skips a held lockThomas Bachem via GitGitGadget, Sep 28, 2026
  30. Patrick SteinhardtSep 30, 2026
  31. Thomas BachemOct 1, 2026
  32. Patrick SteinhardtOct 1, 2026
  33. 3/3 rerere: go on at a conflict when the lock stays busyThomas Bachem via GitGitGadget, Sep 28, 2026
  34. 0/3 rerere: wait for MERGE_RR.lock, and go on at a conflictThomas Bachem via GitGitGadget, Oct 2, 2026
  35. 1/3 rerere: wait for MERGE_RR.lock before giving upThomas Bachem via GitGitGadget, Oct 2, 2026
  36. 2/3 rerere: add "gc --skip-locked" for auto maintenanceThomas Bachem via GitGitGadget, Oct 2, 2026
  37. Patrick SteinhardtOct 9, 2026
  38. 3/3 rerere: go on at a conflict when the lock stays busyThomas Bachem via GitGitGadget, Oct 2, 2026
  39. Patrick SteinhardtOct 9, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.