Ref qualification and test sweep - #3
Merged
Merged
Conversation
A tag sharing a branch's name silently shadowed the branch: git's ref
search order puts refs/tags/<name> ahead of refs/heads/<name>, and
%(refname:short) returns the shortest *unambiguous* name, which grows a
"heads/" prefix the moment the tag exists. Tagging a release branch with
its own name is ordinary practice, so this reached everyday repos.
The worst symptom was silent: riskCommitCount measured the tag instead of
the branch and reported nothing at risk, so a force delete of a branch
holding real work drew no warning at all.
Resolve refs at the point where the namespace is actually known and carry
them forward, rather than re-deriving later:
- loadBranches reads %(refname)/%(upstream); shortRef strips the
namespace for display and name-keyed lookups.
- remoteDefault, localDefaultBranch and baseBranch return fully
qualified refs. localDefaultBranch previously probed a bare "main",
which a tag satisfies, leaving the bug live on the no-remote path.
- remoteDefault drops symbolic-ref --short, which has the same
shortest-unambiguous hazard.
- branchRef qualifies local branch names for git; the model keeps
riskBase for display alongside riskBaseRef for git.
- push --delete takes a qualified refspec. A bare one is rejected as
matching more than one ref when the remote also carries the tag,
deleting nothing. This also makes deleting an already-absent remote
branch idempotent rather than an error, which is the better trade:
the race ends in the state the user armed.
Also preserve pending selections across a fetch. `p` reloaded every
branch struct and silently discarded the user's selections and armed
remotes; a fetch mutates nothing local, so carryMarks copies them onto
the new set. An armed remote is dropped when the fetch reveals the
upstream is gone, since that push could only fail.
Startup stays at 7 git subprocesses, verified with a logging shim.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Records the three-tier review of everyday git edge cases the suite did not construct, what each tier found, and the corrections real repos forced on three predictions made before testing them. The "Ref handling" section states the rule the bug fixes established, so the shortest-unambiguous-name trap is not walked into again. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
No description provided.