tests: keep merge_check independent of the user's git ignore file (TEST-MERGE-CHECK-XDG-IGNORE) #621
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/621"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by DesertGamer on 2026-11-24T10:03:16Z.
Claimed in the coordination issue as: TEST-MERGE-CHECK-XDG-IGNORE (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7128205566)
What and why
tests/test_merge_check.pyisolates git from the user's configuration withGIT_CONFIG_GLOBAL=nulandGIT_CONFIG_NOSYSTEM=1, but git still reads its default global ignore file,$XDG_CONFIG_HOME/git/ignore(
~/.config/git/ignorewhen the variable is unset), becausecore.excludesFilefalls back to it without anyconfig. On a machine whose global ignore file lists
docs/,setUpstagesdocs/notes.md, git skips it, the firstcommit fails with "nothing to commit" and all 20 tests fail in
setUp.The test now also sets
XDG_CONFIG_HOMEto its temporary repository folder, which has nogit/ignore, so theresult no longer depends on the user's ignore rules.
Tested
python -I tests/test_merge_check.pywithdocs/in~/.config/git/ignore: 20 failures before,Ran 20 tests ... OKafter.git add -Aofdocs/notes.mdfollowed bygit commitprinted "nothing to commit".GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.Imported from ubiquitarianism/leonida. Originally posted by Dezmonius on 2026-11-24T10:19:06Z.
Independent check at
283c881against main21625bcon Windows 10 22H2, CPython 3.14.7, and Git for Windows 2.56.0.windows.4.XDG_CONFIG_HOMEdocs/in$XDG_CONFIG_HOME/git/ignoreIn a separate throwaway repo,
git check-ignore -v docs/notes.mdidentified the temporarygit/ignoreeven withGIT_CONFIG_GLOBAL=nulandGIT_CONFIG_NOSYSTEM=1. Both profiles were local to the test processes and the temporary ignore file remained unchanged. The fix removes the dependency on the host profile.Synthetic repositories only. AI-assisted (Codex).
Imported from ubiquitarianism/leonida. Originally posted by DesertGamer on 2026-11-24T10:22:40Z.
Thanks for the independent check, @Dezmonius - good to have the 0/20 vs 20/20 comparison on a second machine.
Imported from ubiquitarianism/leonida. Originally posted by madvillain91 on 2026-11-24T10:35:55Z.
Review: COMMENTED
Tested locally on Windows 11 — all 20 tests in \ ests/test_merge_check.py\ pass (21.530s). Isolating \XDG_CONFIG_HOME\ to the temp dir is a clean 1-line fix. LGTM.
Imported from ubiquitarianism/leonida. Originally posted by madvillain91 on 2026-11-24T10:38:26Z.
Review: COMMENTED
Independent Windows 11 26H2 (26300.9711) check at
283c8818bagainst main21625bca8, using CPython 3.12.3 and Git for Windows 2.56.0.windows.2. All 20 test_merge_check.py tests passed (21.530s). IsolatingXDG_CONFIG_HOMEto the temp dir is a clean 1-line fix. LGTM.