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
Guard Self-Test Fails on Windows, Blocking Every Native Install #2458
On a native Windows host, gh-write-guard.py --selftest fails. Measured on main at 2.0.853.
The failing cases are 17 of the primary-checkout rule's cases, all about resolving a target directory, each expected to deny and getting allow:
-C naming the primary from a worktree, a relative -C, and a relative -C after an earlier -C
--work-tree, --git-dir alone, --work-tree with -C, and --work-tree naming no repository
a GIT_WORK_TREE=/GIT_DIR= prefix, a leading export, and a leading absolute or relative cd
a bash -c wrapper, a mid-word #, and $HOMEPATH
Every other case passes.
Why it matters
install.py stages each hook and runs its --selftest before replacing anything, so this failure makes every install on Windows refuse with "no hook was replaced". test_install.py run natively shows it: 88 of its 136 cases fail at that step, before reaching what they test.
Likely cause (not yet verified on Windows)
The fixtures name fake checkouts with POSIX strings such as /primary and /repos/worktree-task. _join_relative resolves them with os.path, which is ntpath on Windows.
normpath rewrites / to \, so a resolved path no longer matches its fixture key.
From Python 3.13, ntpath.isabs("/primary") is false, since a path with one leading slash and no drive is no longer absolute. /primary is then joined onto the session cwd.
Either way the lookup misses, and the rule fails open, as it does for any target it cannot resolve.
The same resolution may also affect real use: under Git Bash, an absolute POSIX-style path in a command would be joined onto the cwd rather than read as absolute, so the rule would fail open there too. That needs checking separately from the fixtures.
Done means
--selftest passes on native Windows, and test_install.py runs there with no failure from the hook self-test step.
The native host that showed this runs Python 3.13.15, so the 3.13 change to ntpath.isabs for a path with one leading slash and no drive applies there. On the same host, os.lstat on a path under a regular file raises FileNotFoundError (WinError 3).
Do the fixtures need platform-neutral paths? No. The fixture lookups now read every \ as / in both the key and the queried directory. Only the separator is folded, so a case still fails where the rule stops collapsing ... A new install-suite case runs the self-test with the guard's os.path swapped for ntpath. It fails without the fix (3 cases on 3.12, 14 on 3.13) and passes with it.
Does the real rule fail open for a POSIX-style path from Git Bash? For a drive-prefixed spelling such as /c/repos/..., very likely yes, because MSYS converts the argument and the guard does not. That gap is older than this issue, so it is filed separately as Resolve Git Bash Drive-Prefixed Paths in the Primary-Checkout Rule on Windows #2460.
Emulating ntpath on Linux reproduces 14 of the 17 native failures. A native run of the branch decides the other three.
Activity
ptr727 commentedon Oct 7, 2026
The native host that showed this runs Python 3.13.15, so the 3.13 change to
ntpath.isabsfor a path with one leading slash and no drive applies there. On the same host,os.lstaton a path under a regular file raisesFileNotFoundError(WinError 3).ptr727 commentedon Oct 7, 2026
Answers to the two questions the handoff raised:
\as/in both the key and the queried directory. Only the separator is folded, so a case still fails where the rule stops collapsing... A new install-suite case runs the self-test with the guard'sos.pathswapped forntpath. It fails without the fix (3 cases on 3.12, 14 on 3.13) and passes with it./c/repos/..., very likely yes, because MSYS converts the argument and the guard does not. That gap is older than this issue, so it is filed separately as Resolve Git Bash Drive-Prefixed Paths in the Primary-Checkout Rule on Windows #2460.Emulating
ntpathon Linux reproduces 14 of the 17 native failures. A native run of the branch decides the other three.Match Guard Self-Test Fixtures Across Path Separators for Windows (#2461