Context
After #370, a tracked file's gutter compares with HEAD. But a commit made in another terminal pane doesn't touch the file, so nothing tells the editor to re-read HEAD, and the markers stay stale until the next save. This task makes the markers catch up by themselves when the repo's HEAD moves. Second slice of #138. Needs #370 merged first: it refreshes the baseline that task introduces.
Acceptance criteria
Tests
- A
HEAD move (branch ref updated, HEAD re-pointed on checkout, ref moved inside packed-refs) triggers a baseline re-read for every open tab in that repo and none in other repos.
- Worktrees:
.git is a file there and the branch ref lives in the common git dir (git rev-parse --git-dir --git-common-dir); detached HEAD too.
- Bursts of ref changes (a rebase) are coalesced rather than re-reading per event.
- Fallback to re-reading on tab shown when the watch can't be set up, mirroring
DiskChanges.
- Watches are released when the last tab from a repo closes and when the folder changes.
- Update
AGENTS.md § Editor gutter.
Out of scope
- Git status in the Explorer, or refreshing the Review tab.
- Watching anything beyond what's needed to notice
HEAD moving (e.g. the index, to show staged changes).
- Any new command, key or setting.
Context
After #370, a tracked file's gutter compares with
HEAD. But a commit made in another terminal pane doesn't touch the file, so nothing tells the editor to re-readHEAD, and the markers stay stale until the next save. This task makes the markers catch up by themselves when the repo'sHEADmoves. Second slice of #138. Needs #370 merged first: it refreshes the baseline that task introduces.Acceptance criteria
git commit -ain another terminal pane: the markers clear by themselves while the file is on screen, without switching tabs or saving.git add -p, then commit) in another pane: only the uncommitted lines stay marked.git reset HEAD~1(soft) in another pane: the markers for the undone commit's lines come back.Tests
HEADmove (branch ref updated,HEADre-pointed on checkout, ref moved insidepacked-refs) triggers a baseline re-read for every open tab in that repo and none in other repos..gitis a file there and the branch ref lives in the common git dir (git rev-parse --git-dir --git-common-dir); detachedHEADtoo.DiskChanges.AGENTS.md§ Editor gutter.Out of scope
HEADmoving (e.g. the index, to show staged changes).