Skip to content

test(scope): isolate the scope detection test from host Git config - #230

Open
chriscoveries wants to merge 2 commits into
ChesterRa:mainfrom
chriscoveries:fix/scope-test-hermetic-0458
Open

chriscoveries wants to merge 2 commits into
ChesterRa:mainfrom
chriscoveries:fix/scope-test-hermetic-0458

Conversation

@chriscoveries

Copy link
Copy Markdown
Contributor

Problem

detected_scope_returns_the_normalized_remote_and_python_compatible_key runs git init and git remote add under the developer's own Git configuration, so a global or system setting can change the remote the test reads back. For example, a url."https://example.invalid/".insteadOf = git@ rule in ~/.gitconfig rewrites the SSH remote before the scope is derived, and the test fails on that machine while passing elsewhere.

Change

  • The test runs Git with an empty global config (GIT_CONFIG_GLOBAL), no system config, and a temporary HOME, and plants a hostile ~/.gitconfig there to prove it does not leak in.
  • detect passes an empty environment list down to git_output. Production calls are unchanged and still go through background_command.
  • The null config path uses the platform null device (NUL on Windows, /dev/null elsewhere).

No production behaviour changes. One file, +40/-19.

How this was tested

  • cargo test --locked -p cccc-pair-core at ea7d733 on Linux x86_64 (self-hosted CI runner, 7 vCPU, 7 GiB): 502 passed, 0 failed, 1 ignored, including scope::tests::detected_scope_returns_the_normalized_remote_and_python_compatible_key.
  • Not run on macOS or Windows.

This branch has not been deployed

No deployments
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.

1 participant