fix: stop truncating local branch names containing '/' - #147
Merged
Conversation
added 2 commits
August 10, 2026 14:57
Commit Tree's ref classification assumed any decoration containing '/'
was a remote-tracking ref (<remote>/<branch>), which also matches a
local branch's own name once it's no longer checked out (e.g.
`test/some_experiment` decorates as the bare name, no `HEAD -> `
prefix). Two context-menu actions then stripped everything up to the
first '/', truncating the branch to `some_experiment` for both
checkout and delete.
- dagLayout.ts's parseRefs() no longer guesses "remote" from '/' alone;
it tags such refs "ambiguous" instead.
- CommitGraph.vue's commitRefs() is now the sole authority that
resolves "ambiguous" against the real branch list, defaulting to
"branch" (not "remote") when no match is found — the actual bug
scenario, since props.branches can be empty/stale right after a
repo/tab switch.
- Replaced the remaining ad-hoc `indexOf('/')` slicing in the checkout
context-menu handler with a single computed derived from the
now-trustworthy classification, and documented why the equivalent
slicing in branchToDelete's confirmed-remote branch stays safe.
Added regression tests for parseRefs() and for CommitGraph's checkout/
delete emit paths with a slash-named local branch, plus coverage
confirming origin/main and tags still classify correctly.
# Conflicts: # CHANGELOG.md
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.
Summary
dagLayout.ts'sparseRefs()classified any slash-containing ref decoration astype: "remote", assuming shape<remote>/<branch>. A local branch liketest/some_experiment, once switched away from, decorates identically (noHEAD ->prefix) and got misclassified the same way.CommitGraph.vue'scommitRefs()only corrected the type when it found a match inprops.branches; an empty/stale list (e.g. right after a repo/tab switch) let the wrong"remote"type through./, assuming a remote prefix — truncatingtest/some_experimenttosome_experimenton checkout and delete.Fix:
parseRefs()now tags such refs as a new neutral"ambiguous"type instead of guessing"remote".commitRefs()is the sole authority resolving"ambiguous"against the ground-truth branch list, defaulting to"branch"(not"remote") when unmatched. The checkout/delete code paths now only strip the remote prefix oncetype === "remote"has been positively confirmed.Test plan
dagLayout.test.ts: 6/6 passCommitGraph.branchSlash.test.ts: 5/5 pass, including explicit regression coverage thatorigin/mainand tags still classify correctlyFixes #137