Repository navigation
Report no head for a worktree on an unborn branch [patch] - #212
Open
matt-edmondson wants to merge 1 commit into
Open
matt-edmondson wants to merge 1 commit into
matt-edmondson wants to merge 1 commit into
Conversation
git worktree list prints a HEAD line even on an unborn branch, carrying the all-zero null id, and the parser passed it through as a commit. The null-id check GitSubmoduleParser already used moves to GitParseValues so the worktree parser can share it, and an all-zero HEAD (40 or 64 characters) now yields Head = null, as GitWorktree.Head documents. Fixes #165 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BkmjSwCY4KW87X2ccQhj7T
|
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.



Fixes #165
What changed
git worktree list --porcelainstill prints aHEADline on an unborn branch, and its value is the all-zero null id.GitWorktreeParserturned that into aGitCommitSha, soGitWorktree.Headlooked like a real commit.IsNullObjectIdhas moved fromGitSubmoduleParser(private) toGitParseValues(internal). Its body is unchanged, and the submodule parser now calls the shared copy.GitWorktreeParsernow reports an all-zeroHEADasHead = null. Because the check looks at the digits rather than a fixed length, both 40- and 64-character ids are covered.GitWorktree.Headremarks now say that an unborn branch also reports null.Tests
ReportsNoHeadForAnUnbornBranchcovers the SHA-1 (40) and SHA-256 (64) forms.WorktreesReportsNoHeadForAFreshRepositoryAsynccallsWorktrees()on a freshly initialised repository and expectsHead == nullwith branchmain.IsNullObjectId(value + "x"), which never matches. All three cases failed, then passed again once the change was restored.KTSU_GIT_INTEGRATION_TESTS_REQUIRED=1: 803 of 803 passed.🤖 Generated with Claude Code
https://claude.ai/code/session_01BkmjSwCY4KW87X2ccQhj7T
Generated by Claude Code