Repository navigation
fix(git): recognize local SHA-256 workspace bases - #35010
Conversation
isFullGitObjectId only matched 40-hex IDs, so a saved 64-hex commit base in a SHA-256 repo was treated as missing, triggering an unneeded origin fetch and a fallback to the default branch.
8e33fcc to
0b6306b
Compare
|
No actionable comments were generated in the recent review.
|
Problem
In SHA-256 repositories, full commit IDs are 64 hex characters, but
isFullGitObjectId(src/main/git/commit-object-ref.ts) only accepted 40. A saved commit used as a workspace base was therefore treated as missing locally, which triggered an unnecessary origin fetch during prefetch and could makeresolveWorktreeCreateBasefall back to the default branch, creating the workspace from the wrong commit.Fix
Accept exactly 40 or 64 hex characters. The existing
rev-parse --verify --quiet <id>^{commit}check is unchanged, so an accepted ID must still resolve to a local commit (no new false positives). No wire-shape, RPC, or folder-workspace changes.Validation
commit-object-ref.test.ts: accepts 40/64-hex IDs, rejects 63/65; fails on the old regex.pnpm testfor commit-object-ref, worktree-base-ref-probe, and worktree-create-base-prefetch: 22/22 pass.pnpm check:changed --maxWorkers=2passes.