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

Merged
DesertGamer merged 1 commit from upstream-pr/621 into main 2026-11-24 13:09:58 +00:00
DesertGamer commented 2026-11-24 10:03:16 +00:00 (Migrated from github.com)

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.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.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5470032978 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/621). Originally posted by [DesertGamer](https://github.com/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.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.
Dezmonius commented 2026-11-24 10:19:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Dezmonius on 2026-11-24T10:19:06Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7128612281 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/621#issuecomment-7128612281). Originally posted by [Dezmonius](https://github.com/Dezmonius) on 2026-11-24T10:19:06Z. --- 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).
DesertGamer commented 2026-11-24 10:22:40 +00:00 (Migrated from github.com)

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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7128694043 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/621#issuecomment-7128694043). Originally posted by [DesertGamer](https://github.com/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.
madvillain91 commented 2026-11-24 10:35:55 +00:00 (Migrated from github.com)

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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6037651213 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/621#pullrequestreview-6037651213). Originally posted by [madvillain91](https://github.com/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.
madvillain91 commented 2026-11-24 10:38:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by madvillain91 on 2026-11-24T10:38:26Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6037689546 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/621#pullrequestreview-6037689546). Originally posted by [madvillain91](https://github.com/madvillain91) on 2026-11-24T10:38:26Z. **Review:** COMMENTED --- 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.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!621
No description provided.