Expose additional args when calling Git.clone() - #11921
Merged
Merged
Conversation
memsharded
approved these changes
Aug 20, 2022
memsharded
left a comment
Member
There was a problem hiding this comment.
I agree a generic args is fine, no need to do specific python interface for shallow or others.
I think this can go to 1.52, very low risk, and useful to have.
Co-authored-by: James <james@conan.io>
jcar87
marked this pull request as ready for review
August 22, 2022 10:04
czoido
approved these changes
Aug 22, 2022
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.
Changelog: Feature: Add ability to pass additional arguments to
conan.tools.scm.Git.clone().Docs: conan-io/docs#2721
As a way of addressing: #11797
This PR exposes an
argsparameter when callingGit.clone(), so that we can forward additional parameters to the git command - thus enabling more advanced behaviours than cloning the default branch.This can satisfy the issue in #11797 (by passing e.g. by passing
['--depth', '1']). I believe the most common case when building recipes that clone from a git repository is to want to have it set to a specific commit (branch or tag). Some repositories take considerable time to clone, so the ability to tweak thegit clonewall to make it as quick as possible seems like a good feature to have.I'm unsure as to whether to expose a specific parameter for a shallow clone, what should it be called?
tools.Git()had ashallow=True/False, but other git wrappers for Python have a specificdepthargument, which may match more closely. And if we were to do that, why not others that also control likely toggles, like the submodule recursive (or not) clone behaviour. Exposing an args argument could be a good compromise to cover these cases.