Skip to content

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

Merged
love-linger merged 1 commit into
sourcegit-scm:developfrom
cdammanintopix:fix-fetch-ui-update
Oct 8, 2026
Merged

love-linger merged 1 commit 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

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.

…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.
@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
@love-linger
love-linger merged commit 415e137 into sourcegit-scm:develop Oct 8, 2026
14 checks passed
@cdammanintopix
cdammanintopix deleted the fix-fetch-ui-update branch October 8, 2026 09:32
AquariusStar pushed a commit to AquariusStar/sourcegit that referenced this pull request Oct 10, 2026
- Remove `Trust this repository` checkbox and `CanSure` property, pressing `OK` means trust this repository
- Stop processing drop item when there is an untrusted repository because `SourceGit` only supports to display one popup at a time
- Remove `TryShowTrustRepositoryPopup`
  * Both `OpenRepositoryInTab` and `OpenSubRepository` are used for added repositories.
  * `GetRepositoryGitDir` uses `Directory.Exist` and `File.Exist` first to get the $GIT_DIR

Signed-off-by: leo <longshuang@msn.cn>
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