You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Resolve Git Bash Drive-Prefixed Paths in the Primary-Checkout Rule on Windows #2460
On Windows, Claude Code's Bash tool runs Git Bash. MSYS converts a POSIX-style path argument before git.exe sees it, and the guard reads the command text without that conversion. Its primary-checkout rule can then resolve a directory other than the one git acts on.
A drive-prefixed spelling such as git -C /c/repos/Example reset --hard reaches git as C:/repos/Example. The guard joins it as a path with no drive and gets <drive>:\c\repos\Example.
That directory holds no repository, so the primary-checkout check answers unresolvable, and the rule fails open, as it does for any target it cannot resolve.
The same applies to a leading cd /c/..., to --work-tree and --git-dir, and to a GIT_WORK_TREE= or GIT_DIR= prefix.
A rooted path with no drive, such as /primary, is converted by MSYS to a path under the Git install root. The guard reads it on the base's drive instead.
This is older than #2458, and the fix for #2458 leaves the rule unchanged. It is reasoned from MSYS's argument conversion and has not been reproduced on a native host. The form of the cwd the hook receives on Windows is also unverified, and it decides whether relative spellings are affected too.
Done means
On Windows, the rule resolves /<letter>/... as <LETTER>:/..., the way MSYS does.
A self-test case covers each spelling, and a native Windows run confirms that the drive-prefixed form is denied in a primary checkout.
Activity
Match Guard Self-Test Fixtures Across Path Separators for Windows (#2461
Promote develop to main: Match Guard Self-Test Fixtures Across Path S…
Read Git Bash Drive Spellings as Windows Paths in the Primary-Checkou…
Cover the Exported GIT_WORK_TREE and GIT_DIR Drive Spellings in the G…
Promote develop to main: Read Git Bash Drive Spellings as Windows Pat…