Skip to content

Conversation

@tony
Copy link
Member

@tony tony commented Jan 25, 2026

Summary

  • Add set_home dependency to git_repo fixture so child processes (e.g., spawned by git submodule add) can find $HOME/.gitconfig with protocol.file.allow=always
  • Add regression test test_git_repo_fixture_submodule_file_protocol

Root Cause

The git_repo fixture had set_gitconfig (which sets GIT_CONFIG env var) but not set_home. Child processes spawned by git submodule add don't inherit GIT_CONFIG and need $HOME/.gitconfig to find the protocol configuration.

Test plan

  • New test test_git_repo_fixture_submodule_file_protocol passes
  • All submodule tests pass: uv run pytest tests/cmd/test_git.py -k submodule
  • Full test suite passes: uv run pytest
  • Linting passes: uv run ruff check .
  • Type checking passes: uv run mypy src tests

Fixes #509
See: #509 (comment)

tony added 3 commits January 25, 2026 09:22
…module file protocol

why: Document the issue where git_repo fixture lacks set_home dependency,
causing submodule operations to fail in isolated build environments
what:
- Add test_git_repo_fixture_submodule_file_protocol with xfail marker
- Test isolates HOME to prove child processes can't find gitconfig
- References GitHub issue #509
…sses

why: Child processes spawned by git submodule operations need HOME set
to find $HOME/.gitconfig with protocol.file.allow=always configuration
what:
- Add set_home fixture dependency to git_repo fixture
- Fixes GitHub issue #509 for users of git_repo fixture
why: The git_repo fixture now has set_home dependency, so the test passes
what:
- Remove @pytest.mark.xfail from test_git_repo_fixture_submodule_file_protocol
- Update docstring to document the fix
@codecov
Copy link

codecov bot commented Jan 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.46%. Comparing base (53da824) to head (54d3187).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #511      +/-   ##
==========================================
+ Coverage   53.38%   53.46%   +0.07%     
==========================================
  Files          38       38              
  Lines        5696     5705       +9     
  Branches     1063     1063              
==========================================
+ Hits         3041     3050       +9     
  Misses       2144     2144              
  Partials      511      511              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tony tony changed the title Fix git_repo fixture for submodule file:// protocol Fix git_repo fixture for submodule file:// protocol Jan 25, 2026
@tony
Copy link
Member Author

tony commented Jan 25, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

tony added a commit that referenced this pull request Jan 25, 2026
why: Document the pytest plugin fix for users upgrading
what:
- Add changelog entry for git_repo fixture set_home dependency
why: Document the pytest plugin fix for users upgrading
what:
- Add changelog entry for git_repo fixture set_home dependency
@tony tony force-pushed the libvcs-0.38.3-fix branch from 6dba85d to 54d3187 Compare January 25, 2026 15:42
@tony tony merged commit dac1815 into master Jan 25, 2026
8 checks passed
@tony tony deleted the libvcs-0.38.3-fix branch January 25, 2026 15:44
tony added a commit that referenced this pull request Jan 25, 2026
why: The fixture was returning early if .gitconfig already existed,
even if the file was empty or missing protocol.file.allow=always.
This caused failures on Arch Linux build where git/container setup
creates an incomplete .gitconfig before the fixture runs.

what:
- Remove early return that skipped writing when file exists
- Fixture now always writes the full config with protocol.file.allow
- Follow-up to #510, #511 for #509
tony added a commit that referenced this pull request Jan 25, 2026
why: The fixture was returning early if .gitconfig already existed,
even if the file was empty or missing protocol.file.allow=always.
This caused failures on Arch Linux build where git/container setup
creates an incomplete .gitconfig before the fixture runs.

what:
- Remove early return that skipped writing when file exists
- Fixture now always writes the full config with protocol.file.allow
- Follow-up to #510, #511 for #509
tony added a commit that referenced this pull request Jan 25, 2026
## Summary

- Fix `gitconfig` fixture to always write config - removes early return that skipped writing when file exists
- Follow-up to #510, #511 for #509

## Problem

The `gitconfig` fixture had an early return at lines 157-158:

```python
if gitconfig.exists():
    return gitconfig
```

If ANYTHING creates `.gitconfig` first (empty or incomplete) - git itself during `git init`, the nspawn container setup, another fixture - the fixture returns early WITHOUT writing `protocol.file.allow=always`.

Confirmed by reporter running debug script: empty `.gitconfig` was created by container/git before the fixture could write the proper config.

## Solution

Remove the early return. The fixture now always writes the complete config with `protocol.file.allow=always`.
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.

test failure against python 3.14

2 participants