fix: isolate integration tests from host repo git config#41
Merged
guodong-sq merged 1 commit intomainfrom Mar 21, 2026
Merged
Conversation
When running integration tests from inside a repo with wt.enabled=true in .git/config, wt_read_git_config() picks up the real repo's config and overwrites the test's isolated WT_* variables, causing all integration tests to fail with "fatal: invalid reference" errors. Add _WT_SKIP_GIT_CONFIG env var guard to wt_read_git_config() that tests set via setup_test_env(). This follows the existing pattern of _wt_is_interactive override in lib/wt-adopt for test overrides. Unit tests that directly exercise wt_read_git_config unset the guard in their setup() so they can test the function against their own mock repos. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_WT_SKIP_GIT_CONFIGenv var guard towt_read_git_config()inlib/wt-commonsetup_test_env()intest/test_helper/common.bashwt_read_git_configunset the guard in theirsetup()Problem
When running integration tests locally from a repo with
wt.enabled=truein.git/config,wt_read_git_config()finds the real repo's config (highest priority), overwrites the test's isolatedWT_*env vars, and commands operate against the wrong repo — causing 57 integration test failures.Fix
A one-line guard at the top of
wt_read_git_config():This follows the existing
_wt_is_interactiveoverride pattern inlib/wt-adopt.Test plan
cd test && bats unit/ integration/(was 57 failures before)wt.enabledso was unaffected)🤖 Generated with Claude Code