Skip to content

diff: the pane reads the diff again after a rebase that finished - #98374

Merged
poteat merged 1 commit into
mainfrom
poteat/diff-finished-rebase
Sep 30, 2026
Merged

poteat merged 1 commit into
mainfrom
poteat/diff-finished-rebase

Conversation

@poteat

@poteat poteat commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Summary

TLDR: after a rebase that finished, the diff pane shows the diff again instead of "Diff unavailable"

A file git leaves behind a finished rebase no longer reads as a rebase under way.

Notes

  • git keeps REBASE_HEAD after a rebase that stopped on a conflict in its last commit and was then continued or skipped (seen on git 2.43 and 2.50). The pane read that file alone as a rebase under way, so every read failed and the pane said "Diff unavailable" until the file went, which could be hours.
  • git's manual defines REBASE_HEAD as the commit "at which the operation is currently stopped" during a rebase (gitrevisions). By what git does when run: with that file alone git status reports nothing to commit, and it reports a rebase while the folder rebase-merge or rebase-apply is there.
  • A rebase now counts as under way while REBASE_HEAD is there beside one of a rebase's folders: rebase-merge, or rebase-apply holding rebasing, which is how that folder differs from the one a stopped git am keeps.
  • This only narrows what counts. Whatever showed a diff before still shows it: a stopped git am, a rebase paused at a break or at a failed exec. A merge, a cherry-pick and a revert under way read as before; none of them was seen to leave its file behind.
  • A symbolic link by any of those names counts as nothing, as before.
  • The pane picks the diff up at its next read: the next edit or command.

Test Plan

  • claude plugin test mods/diff passes
  • Rebase a branch so that its last commit conflicts, resolve, git rebase --continue; start a session there, change a file, /diff: the pane shows the diff
  • Stop a rebase on a conflict and open /diff: the pane reads "Diff unavailable"
  • Stop git am on a conflict and open /diff: the pane shows the diff, as before

Revert-proof: 3 new tests fail with the probe's change reverted (the mod's own suite, run against the unchanged modules); 4 more pin what must not change and pass both ways

Changelog

@konsta95

Copy link
Copy Markdown

Checked this against #94847, which opens the pane on the first edit only once a fetch lists a file (register.ts L516).

With #94847 alone, the leftover REBASE_HEAD still counts as a rebase in progress, so the pane never opens on an edit. With this PR, it opens with the diff.

They merge cleanly, and the merged diff suite passes 188/188 on 2.1.285. Test for all four cases, with the git steps: gist.

@poteat
poteat enabled auto-merge (squash) September 30, 2026 19:15
@poteat
poteat merged commit 9778ad7 into main Sep 30, 2026
3 of 5 checks passed
konsta95 added a commit to konsta95/claude-code that referenced this pull request Sep 30, 2026
poteat's rebase detection: REBASE_HEAD counts as a rebase only beside a
rebase-merge directory, or a rebase-apply one holding `rebasing`. It merges
without conflicts and brings main up to 732e167.

Co-authored with a harness running Claude and Codex teams.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: 16cb7844-98c6-4af7-b67a-3e9d16705e7f
konsta95 added a commit to konsta95/claude-code that referenced this pull request Sep 30, 2026
main now has poteat's anthropics#98374, anthropics#98445 and anthropics#98357 as squash commits
(9778ad7, 292c5b8, 525d3b3). Its mods/ is identical to 732e167
with the three PR heads merged, which this bundle has already merged
from the heads. The six files that conflict keep the bundle's text from
the first parent, so mods/ is unchanged by this merge. CHANGELOG.md and
feed.xml come from main.

Co-authored with a harness running Claude and Codex teams.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: 16cb7844-98c6-4af7-b67a-3e9d16705e7f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants