Skip to content

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

Description

@a-team-app

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

  • With a file showing uncommitted changes, run git commit -a in another terminal pane: the markers clear by themselves while the file is on screen, without switching tabs or saving.
  • Commit only some of a file's changes (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.
  • Switching branches or pulling in another pane updates the markers on every open tab from that repo, including tabs not currently shown.
  • This works the same in a linked git worktree as in the main checkout.
  • Tabs from a different repo, and files outside any repo, are unaffected.
  • Where the editor can't watch the repo, the markers catch up when you switch to the tab instead, with no error or status message.

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a-team:devClaimed by the a-team Dev

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions