test(worktrees): keep the system gitconfig out of the code under test (#776)

The two stubs from #776 cover the global ignore file and the global config. A core.excludesFile in the system gitconfig still reached the code under test and failed the same test (reproduced with GIT_CONFIG_SYSTEM pointing at one). GIT_CONFIG_NOSYSTEM closes that, as test/git-hooks.test.ts already does for its code under test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-11-08 04:07:39 +01:00
1 parent e19b2c3a54
commit 2e61ac9534
1 file changed
+2
+2
View File
@@ -209,8 +209,10 @@ describe('git worktrees on a real repository', () => {
// The code under test runs git with the real process env. git reads the global ignore file
// from $XDG_CONFIG_HOME/git/ignore, which GIT_CONFIG_GLOBAL does not cover: a user who
// ignores `.claude/settings.local.json` globally would see that line silently not appended.
// A core.excludesFile in the system gitconfig does the same, hence GIT_CONFIG_NOSYSTEM.
vi.stubEnv('XDG_CONFIG_HOME', join(dir, 'xdg'));
vi.stubEnv('GIT_CONFIG_GLOBAL', '/dev/null');
vi.stubEnv('GIT_CONFIG_NOSYSTEM', '1');
repoDir = join(dir, 'repo');
mkdirSync(repoDir);
git(repoDir, 'init', '-q', '-b', 'main');