Skip to content

perf(repo): resolve is_remote_tracking_branch via cached inventory - #2377

Merged
max-sixty merged 1 commit into
mainfrom
is-remote-tracking-inventory
Apr 22, 2026
Merged

max-sixty merged 1 commit into
mainfrom
is-remote-tracking-inventory

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

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 #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 (so git push doesn't push to main).

Minor behavioural divergence: <remote>/HEAD symrefs now return false because the inventory excludes them. The call site receives user-supplied base branches (e.g. origin/main), not origin/HEAD, so this is benign in practice.

This was written by Claude Code on behalf of Maximilian

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]>
@max-sixty
max-sixty merged commit f808ed3 into main Apr 22, 2026
25 checks passed
@max-sixty
max-sixty deleted the is-remote-tracking-inventory branch April 22, 2026 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants