Repository navigation
perf(repo): resolve is_remote_tracking_branch via cached inventory - #2377
Merged
Merged
Conversation
Drops the `git rev-parse --verify refs/remotes/<ref>` subprocess in favor of a lookup against the `Repository::remote_branches()` inventory already populated by a single `for-each-ref` scan per Repository lifetime. Mirrors the cutover PR #2372 did for `strip_remote_prefix`. Sole caller is `wt switch --create feature <base>`'s safety check that decides whether to unset the auto-assigned upstream on the new branch. Minor behavioural divergence: `<remote>/HEAD` symrefs now return `false` because the inventory excludes them. The call site receives real base branches (e.g. `origin/main`), not `origin/HEAD`, so this is benign. Co-Authored-By: Claude <[email protected]>
worktrunk-bot
approved these changes
Apr 22, 2026
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.
Drops the
git rev-parse --verify refs/remotes/<ref>subprocess in favor of a lookup against theRepository::remote_branches()inventory already populated by a singlefor-each-refscan per Repository lifetime.Mirrors the cutover #2372 did for
strip_remote_prefix. Sole caller iswt switch --create feature <base>'s safety check that decides whether to unset the auto-assigned upstream on the new branch (sogit pushdoesn't push tomain).Minor behavioural divergence:
<remote>/HEADsymrefs now returnfalsebecause the inventory excludes them. The call site receives user-supplied base branches (e.g.origin/main), notorigin/HEAD, so this is benign in practice.