Skip to content

Fix issues of GitFS providers with GitCLI#68926

Merged
dwoz merged 6 commits intosaltstack:masterfrom
dwoz:gitfs
Apr 16, 2026
Merged

Fix issues of GitFS providers with GitCLI#68926
dwoz merged 6 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.

@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 5 commits April 15, 2026 01:39
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.
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.
- Consolidated duplicated GitCLI class implementations into a single cohesive class.
- Fixed environment filtering in envs() to correctly re-initialize config attributes (ref_types, disable_saltenv_mapping) from the instance, ensuring global and per-remote overrides are respected.
- Added missing threading import in salt/utils/gitfs.py.
- Cleaned up unnecessary pass statement in setup_callbacks to satisfy pylint.
Copy link
Copy Markdown
Collaborator

@sujitdb sujitdb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

4 participants