Repository navigation
fix(tests): use /dev/null as the empty global git config on Windows too - #8746
Draft
andrew05060414 wants to merge 2 commits into
Draft
andrew05060414 wants to merge 2 commits into
andrew05060414 wants to merge 2 commits into
Conversation
…tform Git for Windows 2.56 rejects GIT_CONFIG_GLOBAL=NUL with "fatal: unable to access 'NUL': Invalid argument". The test fixture env and the preload's git config guard both set it on win32, so every fixture repository and the guard's first check failed on that git. Git for Windows maps /dev/null to its null device, and a git that did not would read the path as a missing file, which is also an empty config. One exported constant now feeds the fixture env, the guard and the oracle, and a new case runs the installed git with the fixture env.
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Contributor
|
✅ Deterministic PR hygiene checks passed. |
Contributor
⏳ DRAFT
What to do
Review readiness checklist
0/4 boxes ticked. This PR stays in draft until every box above is ticked. |
This branch has not been deployed
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.
Summary
Problem. On Windows with Git for Windows 2.56, a large block of the test suite fails on every branch for reasons unrelated to the code under test. The shared test git environment (
tests/helpers/git-fixture.ts) and the preload's.git/configguard (tests/helpers/git-config-guard.ts) setGIT_CONFIG_GLOBAL=NULon win32, and git 2.56 refuses that value outright:So every fixture repository fails to initialise, and the guard reports "git could not parse the checkout's common .git/config" on the first case of every file. Contributors on Windows currently work around it by pointing
OCX_GIT_CONFIG_GUARD_CHECKOUTat a directory with no.git, which also switches the guard off.After this PR. The empty global config is
/dev/nullon every platform, exported once asEMPTY_GLOBAL_GIT_CONFIGand used by the fixture env, the guard, and the isolation test's oracle env. Linux and macOS behaviour is unchanged (they already used/dev/null).Why
/dev/nullis safe on Windows. Git for Windows maps/dev/nullto its null device (verified on 2.56 from a native Bun spawn, not only from Git Bash). A Git for Windows build that did not map it would see a missing file, which git treats as an empty global config — the intent either way. Probed on 2.56 from Bun:NUL→ exit 128;/dev/null,nul→ exit 0.Details.
tests/helpers/git-fixture.ts: new exportedEMPTY_GLOBAL_GIT_CONFIG = "/dev/null"with the reason in a comment;fixtureGitEnvuses it.tests/helpers/git-config-guard.ts: imports the constant instead of its ownNULbranch.tests/ci-workflows/test-git-isolation.test.ts: oracle env and the env assertion use the constant; a new case runs the installed git withfixtureGitEnv()(git config --global --list) and requires exit 0 with empty stderr, so a git that rejects the value fails loudly instead of failing dozens of unrelated cases.devlog/_plan/261113_test_git_env_isolation/010_phase1.md: the one line describing the old per-platform value.Verification
Windows 11, Git for Windows 2.56.0.windows.1, Bun 1.4.4. Same 12 files on clean
upstream/dev(873ec9b) and on this branch, run withbun scripts/test.ts <files>and without theOCX_GIT_CONFIG_GUARD_CHECKOUTworkaround: every file that importstests/helpers/git-fixture.tsor the guard (ci-workflows/{build-release-changelog,ci-gui-typecheck-gate,ci-review-lanes,ci-test-lane,release-version-sources,repo-hygiene,repo-import-resolution,structure-ssot,test-git-isolation,test-runner},gui/platform-dialog-guard,test-layout-tooling).upstream/devThe 2 remaining failures also fail on
upstream/devand are not caused by the null-device value:test-runner > changed-mode uses the shared merge base…hits the 5 s timeout insidecommitFixtureon this Windows host, andtest-git-isolation > test preload > fails the case after which the guarded checkout's config changednow reaches the guard correctly (it reportsuser.name changed) but the probe output on Windows does not contain the(pass) leaves the config aloneline the assertion looks for. Both are left for a separate change.bun run typecheck— no type errors.bun run structure:check— passed.Checklist
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.