Skip to content

test: the git-maintenance guard can read green from an ambient system gitconfig #665

Description

@pbean

test_template_leaves_no_detached_git_maintenance_writing_into_the_copies
(tests/test_conftest.py) grades behavior rather than the config key: it commits
into a real copy under GIT_TRACE2_EVENT and asserts no child_start event names
a maintenance or gc child. Its ablation — deleting
tests/conftest.py:458 — reddens that row alone, verified.

The channel

_isolate_ambient_git_ignores (tests/conftest.py:366) deliberately leaves
GIT_CONFIG_NOSYSTEM unset, documented at :382. So the probe subprocess still
reads the host's system gitconfig. On a host whose system config already sets
maintenance.auto=false or gc.auto=0, the spawn is suppressed for a reason that
has nothing to do with the fixture, and the row stays green even with the fixture
line deleted — the ablation would not redden there.

This does not affect CI (neither the ubuntu-24.04 nor the windows-2025 runner
image ships such a system config) and it does not weaken the fix itself, only the
guard's ability to prove the fix is what is doing the work on an arbitrary
contributor's box.

Options

  • Set GIT_CONFIG_NOSYSTEM=1 on that one probe subprocess.run env, scoping the
    hardening to the assertion that needs it rather than to the whole suite. The
    existing env dict already passes {**os.environ, "GIT_TRACE2_EVENT": ...}, so
    this is one key.
  • Or record the channel in the docstring so a contributor who ablates and sees
    green knows to check their system config first.

The narrow env-var scoping is preferred over touching
_isolate_ambient_git_ignores, whose choice not to set GIT_CONFIG_NOSYSTEM
globally is deliberate and load-bearing for other rows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4Parked - needs design, blocked upstream/PR, or speculativebugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions