Skip to content

The gutter catches up when HEAD moves in another pane - #377

Merged
jamescrosswell merged 1 commit into
mainfrom
feat/gutter-head-watch
Oct 2, 2026
Merged

jamescrosswell merged 1 commit into
mainfrom
feat/gutter-head-watch

Conversation

@a-team-app

@a-team-app a-team-app Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

The gutter now catches up by itself when HEAD moves outside the editor. Commit, partially commit, reset --soft, switch branch or pull in another pane, and every open tab from that repo is marked against the new HEAD, including tabs that aren't showing. That works the same in a linked worktree. Tabs from other repos, and files outside any repo, aren't touched.

Closes #371

Notes:

  • Any change to packed-refs re-reads, even a git pack-refs that doesn't move HEAD. Those are rare, and it's simpler than parsing the file to see whether the current branch moved.
  • If the repo can't be watched (for example, the system has run out of inotify instances), the tab re-reads when it's shown, with no message, as the issue asks.

a-team try tuicode 377

A commit, checkout, reset or pull in another terminal pane doesn't touch
the open files, so nothing told the editor to re-read HEAD and the
gutter's markers stayed stale until the next save.

HeadWatcher watches each open repo's git dir for HEAD and its common dir
for packed-refs and refs/heads (recursively, for branches with a slash),
debounced like DiskWatcher. GitRepository.Dirs resolves both from the
filesystem, so a linked worktree follows its own HEAD and the shared
branches. On a flush only HEAD, packed-refs and the branch HEAD names
count, so `git status` rewriting the index re-reads nothing. A repo whose
watch can't be set up re-reads a tab when it's shown instead.

Closes #371

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@a-team-app
a-team-app Bot marked this pull request as ready for review October 1, 2026 23:39
@jamescrosswell
jamescrosswell merged commit 1a2804d into main Oct 2, 2026
23 of 24 checks passed
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.

The gutter catches up when I commit or switch branch in another pane

1 participant