Repository navigation
Conversation
pygit2 1.21.0 returns a RepositoryConfig from Repository.config, and its add_file() always raises TypeError, so Pygit2.init_remote failed for every gitfs, git_pillar and winrepo remote. The add_file() call was redundant anyway: the repository config already reads .git/config at the local level and libgit2 re-reads it when it changes on disk. On older pygit2 versions the extra call only loaded the same file a second time, so every multivar (such as the fetch refspecs) showed up twice. Drop the call. Fixes saltstack#70673
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Removes the
self.repo.config.add_file(<gitdir>/config)call fromPygit2.init_remote. pygit2 1.21.0 returns aRepositoryConfigfromRepository.configwhoseadd_file()always raisesTypeError, so every pygit2 gitfs/git_pillar/winrepo remote failed to initialize.The call was redundant: the repo config already loads
.git/configat the local level and libgit2 re-reads it when it changes, so whatenforce_git_config()writes is still picked up. On older pygit2 it just loaded the file a second time, sofetch_refspecslisted every refspec twice. I checked this on pygit2 1.8.0 through 1.21.0, so I dropped the call instead of gating it on the version.What issues does this PR fix or reference?
Fixes #70673
Previous Behavior
With pygit2 1.21.0,
fileserver.update(and git_pillar/winrepo) fails withTypeError: The local repository configuration does not support adding files.fromPygit2.init_remote. With older pygit2, the in-memory repo config has.git/configloaded twice, so the fetch refspecs are duplicated.New Behavior
pygit2 remotes initialize with 1.21.0, and the repo config has each refspec once on all versions.
Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Added
test_init_remote_pygit2_git_configintests/pytests/unit/utils/test_gitfs.py. It fails before the change on 1.21.0 (theTypeError) and on 1.15.1/1.19.2 (duplicated refspecs), and passes after.tests/pytests/unit/utils/test_gitfs.pyandtests/pytests/functional/utils/gitfs/ -k pygit2 --run-slowpass with pygit2 1.15.1, 1.19.2 and 1.21.0. Without the change, the functional pygit2 tests all fail on 1.21.0 (16 failed).Commits signed with GPG?
No