Skip to content

Comments

Fix test isolation from user's global git config#129

Merged
k1LoW merged 1 commit intok1LoW:mainfrom
usadamasa:run-test-local
Feb 11, 2026
Merged

Fix test isolation from user's global git config#129
k1LoW merged 1 commit intok1LoW:mainfrom
usadamasa:run-test-local

Conversation

@usadamasa
Copy link
Contributor

Summary

  • Add TestMain to internal/git and e2e test packages to set GIT_CONFIG_GLOBAL=/dev/null and GIT_CONFIG_SYSTEM=/dev/null, preventing user's global/system git config from leaking into tests
  • Fixes test failures when XDG_CONFIG_HOME is set and $XDG_CONFIG_HOME/git/config contains wt.* settings

Closes #128

Details

Tests previously isolated from global git config by setting HOME to a temp directory. However, when XDG_CONFIG_HOME is explicitly set, Git reads $XDG_CONFIG_HOME/git/config regardless of HOME, causing 5 test failures:

  • TestLoadConfig
  • TestIsBaseDirConfigured/not_configured
  • TestSetConfig
  • TestE2E_LegacyBaseDirMigration/no_legacy_dir_uses_new_default
  • TestE2E_LegacyBaseDirMigration/legacy_dir_exists_errors

Using GIT_CONFIG_GLOBAL / GIT_CONFIG_SYSTEM environment variables (Git 2.32+) is a more robust approach that works regardless of XDG_CONFIG_HOME.

Test plan

  • make test passes
  • make ci passes
  • Verified in environment with XDG_CONFIG_HOME set and wt.* global config present

🤖 Generated with Claude Code

Tests fail when XDG_CONFIG_HOME is set and the user's global git config
contains wt.* settings, because setting HOME to a temp dir does not
prevent Git from reading $XDG_CONFIG_HOME/git/config.

Add TestMain to set GIT_CONFIG_GLOBAL=/dev/null and
GIT_CONFIG_SYSTEM=/dev/null (Git 2.32+) for both internal/git and e2e
test packages.

Closes k1LoW#128

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@k1LoW k1LoW added the enhancement New feature or request label Feb 11, 2026
@k1LoW k1LoW merged commit aba1b73 into k1LoW:main Feb 11, 2026
3 checks passed
@github-actions github-actions bot mentioned this pull request Feb 11, 2026
@k1LoW k1LoW removed the enhancement New feature or request label Feb 11, 2026
@usadamasa usadamasa deleted the run-test-local branch February 11, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tests fail when XDG_CONFIG_HOME is set and global git config contains wt.* settings

2 participants