Skip to content

fix: branch graph not always updated after fetch - #2754

Closed
cdammanintopix wants to merge 2 commits into
sourcegit-scm:developfrom
cdammanintopix:fix-fetch-ui-update
Closed

cdammanintopix wants to merge 2 commits into
sourcegit-scm:developfrom
cdammanintopix:fix-fetch-ui-update

Conversation

@cdammanintopix

Copy link
Copy Markdown
Contributor

Problem

After a fetch, the branch graph was sometimes not updated: new remote commits were missing until a pull or a restart of the app.

Fetch relied only on the filesystem watcher to notice the updated refs/remotes/*, and the watcher missed them in two cases:

  • packed-refs was ignored. A ref updated or deleted only there (e.g. fetch --prune, or the git maintenance run --auto git runs after a fetch) never scheduled a refresh.
  • FileSystemWatcher.Error was not handled. A large fetch writes thousands of object files, which overflows the watcher's internal buffer (8 KB by default). Windows then drops events, including the ones about the refs, and nothing noticed.

Pull was not affected because it also touches HEAD / refs/heads/*, which produces more events.

Changes

  1. Watcher (Models/Watcher.cs)
    • packed-refs changes now schedule a branch and tag refresh.
    • On Error (buffer overflow), we cannot know which events were lost, so schedule a full reload.
  2. Fetch (Fetch, FetchInto, auto-fetch)
    • Refresh branches and tags explicitly once the fetch completes, as other ref-changing operations (AddRemote, DeleteBranch, DeleteRemote, ...) already do. The watcher stays best-effort (it may report nothing on network drives or WSL paths).
    • This does not refresh twice: MarkBranchesDirtyManually also clears the watcher's pending flags. The graph is also updated right away instead of after the watcher's 0.5s delay.

…ffer overflow

The branch graph was sometimes not updated after a fetch, until a pull or a restart.

- `packed-refs` was ignored. A ref updated or deleted only there (e.g. `fetch --prune`, or the
  `git maintenance run --auto` triggered after a fetch) never scheduled a refresh.
- `FileSystemWatcher.Error` was not handled. A large fetch writes thousands of object files,
  which overflows the internal buffer (8 KB by default): Windows then drops events, including
  the ones about `refs/remotes/*`, and nothing noticed. Since we cannot know which events were
  lost, schedule a full reload instead.
Fetch, fetch-into and auto-fetch relied only on the filesystem watcher to show the new remote
refs. The watcher is best-effort: besides the cases fixed in the previous commit, it may not
report anything at all on network drives or WSL paths. Other ref-changing operations
(`AddRemote`, `DeleteBranch`, `DeleteRemote`...) already refresh explicitly; do the same here.

This does not refresh twice: `MarkBranchesDirtyManually` also clears the watcher's pending
flags. It also updates the graph right away instead of after the watcher's 0.5s delay.
@cdammanintopix
cdammanintopix changed the base branch from master to develop September 30, 2026 08:26
Comment thread src/ViewModels/Fetch.cs
Comment thread src/ViewModels/FetchInto.cs
Comment thread src/ViewModels/Repository.cs
@love-linger love-linger self-assigned this Oct 8, 2026
@love-linger love-linger added the bug Something isn't working label Oct 8, 2026
@cdammanintopix
cdammanintopix deleted the fix-fetch-ui-update branch October 8, 2026 08:25
@cdammanintopix

Copy link
Copy Markdown
Contributor Author

Hi, I force pushed the branch to remove the second commit, but this seems to have automatically closed this PR.
I made another one here: #2764

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants