Repository navigation
Conversation
8db6168 to
de2cf6d
Compare
|
Rebased onto latest main — the earlier conflicts (trail_cmd.go, go.mod) are resolved and it's now a single clean commit. Verified locally: build, the NFC/NFD regression tests, and mise run lint all pass. Ready whenever you have a moment. |
de2cf6d to
150c86e
Compare
|
Rebased onto latest main. The only conflict was in Verified locally: |
|
@Soph could you review this when you get a chance? It's rebased onto latest main, now a single clean commit, and mergeable — the only conflict was the |
150c86e to
dcd1cfa
Compare
…entireio#2551) `entire session resume <branch>` compared and looked up branch names byte-exact, so a name differing from the on-disk ref only by Unicode normalization (NFC vs NFD) was reported "not found" even though git treats the two spellings as the same branch (core.precomposeUnicode) and checks it out fine. This bit cross-platform teams: a branch created on Linux (NFD) and synced could not be resumed on a macOS checkout (NFC), especially once refs were packed (go-git matches packed-refs byte-exact). Add ResolveLocalBranchName, which resolves a supplied name to the canonical on-disk ref by folding to NFC when an exact lookup misses, plus branchNamesEquivalent for the "already on this branch" fast path. Thread the resolved name through switchToBranchForResume so the checkout and the downstream checkpoint lookup target the real branch. Regression tests cover the NFC/NFD packed-ref case. Fixes entireio#2551
dcd1cfa to
e093fcc
Compare
Fixes #2551.
Problem
entire session resume <branch>compared and looked up branch names byte-for-byte, with no Unicode normalization. Git treats a precomposed (NFC,éU+00E9) and decomposed (NFD,e+ U+0301) spelling of the same accented branch as one branch (core.precomposeUnicode), sogit checkoutfinds it either way — but entire would reportbranch '<name>' not found locally or on originwhen the supplied name's normalization differed from the on-disk ref. It bit cross-platform teams: a branch created on Linux (NFD) and synced couldn't be resumed on a macOS checkout (NFC), especially once refs were packed (git gc), where go-git matchespacked-refsbyte-exact.Fix
ResolveLocalBranchName(git_operations.go): exact ref match wins; otherwise it scans local branches and matches normalization-insensitively (fold to NFC), returning the canonical on-disk ref name so the checkout and the downstream checkpoint lookup target the real branch. Works on both NFC (macOS) and NFD (Linux) checkouts.branchNamesEquivalent: NFC-folded comparison with an ASCII fast path, used for the "already on this branch" check that previously failed even while standing on the branch.switchToBranchForResumenow returns the resolved canonical name and threads it throughresumeFromCurrentBranch(and the two trail resume callers), so the rest of resume uses the real ref name.golang.org/x/textwas already an (indirect) dependency; this promotes it to direct.Testing
TestResolveLocalBranchName_UnicodeNormalizationInsensitivebuilds an NFD-stored branch with packed refs (deterministic across platforms viacore.precomposeUnicode=false) and asserts the NFC spelling resolves to the canonical NFD ref;TestBranchNamesEquivalent_NFCvsNFDcovers the comparison helper.mise run fmt && mise run lint→ 0 issues. Existing resume/trail/branch tests pass.Scope
Deliberately scoped to the resume path from #2551. Other branch-name comparison sites (e.g.
dispatch --all-branches) share the same underlying gap and could reuse these helpers in a follow-up; happy to do that separately if you'd prefer.