show a warning icon for local branches whose upstream was deleted#259
Open
tsanko wants to merge 1 commit into
Open
show a warning icon for local branches whose upstream was deleted#259tsanko wants to merge 1 commit into
tsanko wants to merge 1 commit into
Conversation
When a local branch tracks a remote branch that has since been deleted (git's `gone` state, e.g. after `fetch --prune` removes the stale remote-tracking ref), nothing in the branches tree signalled that the branch is now orphaned. This surfaces it with a warning icon and a tooltip note so the branch can be noticed and cleaned up. Such branches keep their `branch.<name>.merge`/`remote` config but have no resolved GitBranchTrackInfo, so they can't be detected from tracking info. They are found by parsing the raw git config (GitConfig.parseUpstreamGoneBranches) and checking whether the configured upstream is still present among the known remote branches. The result is plumbed from the backend repo info through the RPC DTO into the shared GitRepositoryState (upstreamGoneBranches) so the frontend renderer can pick the warning icon, with current/favorite states still taking priority over it. Tags and refs that can't track an upstream are never marked gone.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a warning icon (and tooltip note) in the branches tree for local branches whose configured upstream has been deleted on the remote — git's
gonestate, e.g. afterfetch --pruneremoves the stale remote-tracking ref.Why
Orphaned branches were previously indistinguishable from healthy ones in the branches tree, so there was no signal that a branch's upstream is gone and the branch is a cleanup candidate.
How
branch.<name>.merge/remoteconfig but have no resolvedGitBranchTrackInfo, so they can't be detected from tracking info. They're found by parsing the raw git config (GitConfig.parseUpstreamGoneBranches) and checking whether the configured upstream is still present among the known remote branches.GitRepoInfo.upstreamGoneBranches) through the RPC DTO (GitRepositoryStateDto.upstreamGoneBranches) into the sharedGitRepositoryState, so the frontend renderer can pick the warning icon.current/favoritestates still take priority over the warning; tags and refs that can't track an upstream are never marked gone.Tests
GitOrphanedBranchIconTest— unit coverage for icon selection priority andisUpstreamGone.GitOrphanedBranchWidgetTest— end-to-end test exercising the full pipeline (git config → repo info → DTO → shared state → renderer) by pushing a branch, deleting it on the remote, pruning, and asserting the warning icon.