tests: keep merge_check independent of the user's git ignore file (TEST-MERGE-CHECK-XDG-IGNORE) #621

Manually merged
github merged 1 commit from gh-pr/621/head into gh-pr/621/base 2026-11-26 09:12:18 +00:00
Owner

@⁠DesertGamer on GitHub · 2026-11-24 10:03 UTC · original
DesertGamer:fix/merge-check-xdg-ignore → main · +1 −1 · 1 files · 1 commits · merged 2026-11-24 13:09 UTC

Claimed in the coordination issue as: TEST-MERGE-CHECK-XDG-IGNORE (#14)

What and why

tests/test_merge_check.py isolates git from the user's configuration with GIT_CONFIG_GLOBAL=nul and
GIT_CONFIG_NOSYSTEM=1, but git still reads its default global ignore file, $XDG_CONFIG_HOME/git/ignore
(~/.config/git/ignore when the variable is unset), because core.excludesFile falls back to it without any
config. On a machine whose global ignore file lists docs/, setUp stages docs/notes.md, git skips it, the first
commit fails with "nothing to commit" and all 20 tests fail in setUp.

The test now also sets XDG_CONFIG_HOME to its temporary repository folder, which has no git/ignore, so the
result no longer depends on the user's ignore rules.

Tested

  • python -I tests/test_merge_check.py with docs/ in ~/.config/git/ignore: 20 failures before, Ran 20 tests ... OK after.
  • Reproduced the cause outside the test: in a fresh repository with the same environment, git add -A of
    docs/notes.md followed by git commit printed "nothing to commit".
  • Windows 11 Pro 10.0.26200, Python 3.14.6, git for Windows.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.
**@⁠DesertGamer** on GitHub · 2026-11-24 10:03 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/621) `DesertGamer:fix/merge-check-xdg-ignore` → `main` · +1 −1 · 1 files · 1 commits · merged 2026-11-24 13:09 UTC Claimed in the coordination issue as: TEST-MERGE-CHECK-XDG-IGNORE (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### What and why `tests/test_merge_check.py` isolates git from the user's configuration with `GIT_CONFIG_GLOBAL=nul` and `GIT_CONFIG_NOSYSTEM=1`, but git still reads its default global ignore file, `$XDG_CONFIG_HOME/git/ignore` (`~/.config/git/ignore` when the variable is unset), because `core.excludesFile` falls back to it without any config. On a machine whose global ignore file lists `docs/`, `setUp` stages `docs/notes.md`, git skips it, the first commit fails with "nothing to commit" and all 20 tests fail in `setUp`. The test now also sets `XDG_CONFIG_HOME` to its temporary repository folder, which has no `git/ignore`, so the result no longer depends on the user's ignore rules. ### Tested - `python -I tests/test_merge_check.py` with `docs/` in `~/.config/git/ignore`: 20 failures before, `Ran 20 tests ... OK` after. - Reproduced the cause outside the test: in a fresh repository with the same environment, `git add -A` of `docs/notes.md` followed by `git commit` printed "nothing to commit". - Windows 11 Pro 10.0.26200, Python 3.14.6, git for Windows. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed.
The test isolated git with GIT_CONFIG_GLOBAL and GIT_CONFIG_NOSYSTEM, but git
still read its default global ignore file under XDG_CONFIG_HOME. A user rule
such as docs/ left the first commit in setUp empty, so all 20 tests failed.
The test now points XDG_CONFIG_HOME at its temporary folder.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:12:17 +00:00
github manually merged commit 283c8818b4 into gh-pr/621/base 2026-11-26 09:12:18 +00:00
Author
Owner

@⁠Dezmonius on GitHub · 2026-11-24 10:19 UTC · original

Independent check at 283c881 against main 21625bc on Windows 10 22H2, CPython 3.14.7, and Git for Windows 2.56.0.windows.4.

Isolated Git profile Main PR
Empty XDG_CONFIG_HOME 20/20 pass 20/20 pass
docs/ in $XDG_CONFIG_HOME/git/ignore 0/20, all fail at the first commit in setup 20/20 pass

In a separate throwaway repo, git check-ignore -v docs/notes.md identified the temporary git/ignore even with GIT_CONFIG_GLOBAL=nul and GIT_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).

**@⁠Dezmonius** on GitHub · 2026-11-24 10:19 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/621#issuecomment-7128612281) Independent check at `283c881` against main `21625bc` on Windows 10 22H2, CPython 3.14.7, and Git for Windows 2.56.0.windows.4. | Isolated Git profile | Main | PR | | --- | --- | --- | | Empty `XDG_CONFIG_HOME` | 20/20 pass | 20/20 pass | | `docs/` in `$XDG_CONFIG_HOME/git/ignore` | 0/20, all fail at the first commit in setup | 20/20 pass | In a separate throwaway repo, `git check-ignore -v docs/notes.md` identified the temporary `git/ignore` even with `GIT_CONFIG_GLOBAL=nul` and `GIT_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).
Author
Owner

@⁠DesertGamer on GitHub · 2026-11-24 10:22 UTC · original

Thanks for the independent check, @⁠Dezmonius - good to have the 0/20 vs 20/20 comparison on a second machine.

**@⁠DesertGamer** on GitHub · 2026-11-24 10:22 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/621#issuecomment-7128694043) Thanks for the independent check, @⁠Dezmonius - good to have the 0/20 vs 20/20 comparison on a second machine.
Author
Owner

@⁠madvillain91 on GitHub · 2026-11-24 10:35 UTC · original · reviewed

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.

**@⁠madvillain91** on GitHub · 2026-11-24 10:35 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/621#pullrequestreview-6037651213) · **reviewed** 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.
Author
Owner

@⁠madvillain91 on GitHub · 2026-11-24 10:38 UTC · original · reviewed

Independent Windows 11 26H2 (26300.9711) check at 283c8818b against main 21625bca8, using CPython 3.12.3 and Git for Windows 2.56.0.windows.2. All 20 test_merge_check.py tests passed (21.530s). Isolating XDG_CONFIG_HOME to the temp dir is a clean 1-line fix. LGTM.

**@⁠madvillain91** on GitHub · 2026-11-24 10:38 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/621#pullrequestreview-6037689546) · **reviewed** Independent Windows 11 26H2 (26300.9711) check at 283c8818b against main 21625bca8, using CPython 3.12.3 and Git for Windows 2.56.0.windows.2. All 20 test_merge_check.py tests passed (21.530s). Isolating `XDG_CONFIG_HOME` to the temp dir is a clean 1-line fix. LGTM.
This discussion has been locked. Commenting is limited to contributors.
No description provided.