Skip to content

Fix sidebar-refresh to respond to manual refreshes and external branch changes - #562

Merged
hannesa2 merged 1 commit into
gitx:masterfrom
goneng:fix-sidebar-refresh
Aug 9, 2026
Merged

hannesa2 merged 1 commit into
gitx:masterfrom
goneng:fix-sidebar-refresh

Conversation

@goneng

@goneng goneng commented Aug 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • The sidebar's checked-out branch checkmark went stale after a branch change made outside GitX (e.g. git switch in a terminal) or even after clicking GitX's own manual Refresh button, even though the commit-list header updated correctly.
  • reloadRefs already invalidates the repository's cached HEAD ref and fires KVO on refs on every refresh cycle, automatic or manual — PBGitSidebarController just wasn't listening to it.
  • PBGitSidebarController now observes the repository's existing refs property, reloading the outline view (preserving the current selection) so the checkmark badge is recomputed against the current HEAD whenever refs change, regardless of what triggered the refresh.

Also fixes #404.

Test plan

  • Open a repo in GitX with a branch checked out.
  • In a terminal, git switch to a different local branch. Confirm the sidebar checkmark moves within ~1-2s without disturbing the current sidebar selection.
  • Click the manual Refresh button right after an external branch change, before the automatic watcher would fire on its own. Confirm the checkmark updates immediately.

@goneng
goneng marked this pull request as draft August 9, 2026 09:24
@goneng goneng changed the title Fix sidebar-refresh to respond to external branch switch events Fix sidebar-refresh to respond to manual refreshes and external branch changes Aug 9, 2026
…h changes

The sidebar's checked-out branch checkmark does not update after a
branch change made outside GitX (e.g. `git switch` in a terminal), or
even after clicking GitX's own manual Refresh button, even though the
commit-list header already updates correctly in both cases.

reloadRefs already invalidates the cached HEAD ref and fires KVO on
refs on every refresh cycle, automatic or manual, but
PBGitSidebarController never observed that property.

Observe refs in PBGitSidebarController and reload the outline view,
preserving the current selection, so the checkmark badge is
recomputed against the current HEAD whenever refs change, regardless
of what triggered the refresh.
@goneng
goneng force-pushed the fix-sidebar-refresh branch from d8f7688 to 6e92c1a Compare August 9, 2026 11:22
@goneng
goneng marked this pull request as ready for review August 9, 2026 11:34
@hannesa2
hannesa2 merged commit 21e5ff0 into gitx:master Aug 9, 2026
3 checks passed
@hannesa2 hannesa2 added the bugfix label Aug 9, 2026
@goneng
goneng deleted the fix-sidebar-refresh branch August 9, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Manual refresh doesn't update the current branch or the branch list

2 participants