Skip to content

[wip] Fix issues of GitFS providers with GitCLI#68926

Open
dwoz wants to merge 5 commits intosaltstack:masterfrom
dwoz:gitfs
Open

[wip] Fix issues of GitFS providers with GitCLI#68926
dwoz wants to merge 5 commits intosaltstack:masterfrom
dwoz:gitfs

Conversation

@dwoz
Copy link
Copy Markdown
Contributor

@dwoz dwoz commented Apr 13, 2026

Salt's gitfs providers (esspecially pygit2) are prone to memory leaks and uses a lot of memory in general. Both GitPython and pygit2 lack support for fetch depth parameter which means they fetch the entire git history of the repositories being used. This can get very slow when a repository's history grows.

The GitFS provider interacts directly with the system's Git binary. This provider supports shallow clones (depth=1) and optimized tree traversal via ls-tree, significantly reducing latency and memory footprint at scale.

Includes:

  • Minimum Git version check (2.3.0+) for GIT_SSH_COMMAND support.
  • Comprehensive unit tests for the new provider.
  • Integration into the existing GitFS parametrized test suite.
  • Better support for multiple branches by using git for-each-ref quickly determine salt environments.

Add a high-performance GitFS provider that interacts directly with the
system's Git binary. This provider supports shallow clones (depth=1)
and optimized tree traversal via ls-tree, significantly reducing
latency and memory footprint at scale.

Includes:
- Minimum Git version check (2.3.0+) for GIT_SSH_COMMAND support.
- Comprehensive unit tests for the new provider.
- Integration into the existing GitFS parametrized test suite.
@dwoz dwoz requested a review from a team as a code owner April 13, 2026 00:48
@dwoz dwoz added the test:full Run the full test suite label Apr 13, 2026
@dwoz dwoz changed the title Implement GitCLI provider for GitFS Fix issues of existing GitFS providers with GitCLI Apr 13, 2026
dwoz added 3 commits April 13, 2026 01:17
Ensure that mocked or third-party providers used in tests (like 'gitfoo')
are not skipped if they haven't initialized their .repo attribute yet.
This fixes test_update in tests/pytests/unit/runners/test_git_pillar.py.
Ensures that attributes like 'privkey' are available when verify_auth()
is called during initialization via verify_provider(). This fixes
the AttributeError in GitCLI unit tests.
@dwoz dwoz changed the title Fix issues of existing GitFS providers with GitCLI [wip] Fix issues of existing GitFS providers with GitCLI Apr 13, 2026
@dwoz dwoz changed the title [wip] Fix issues of existing GitFS providers with GitCLI [wip] Fix issues of GitFS providers with GitCLI Apr 13, 2026
@bdrx312
Copy link
Copy Markdown
Contributor

bdrx312 commented Apr 13, 2026

@dwoz pygit2 appears to now supports passing depth to clone https://www.pygit2.org/repository.html#pygit2.clone_repository, but according to a comment on the still open issue may not actually work correctly (libgit2/pygit2#630 (comment))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants