-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pip install git+...
from a branch/tag could be faster
#13060
Comments
I can take this if this improvement is approved, I've spotted where the changes should go |
Thanks for reporting, but check this comment: #12949 (comment)
Also, other previous discussions: |
It's also not true that pip always clones the entire repository. Since pip 21.3, pip performs blobless clones where possible (aka git >= 2.17) to speed up clones without breaking projects which rely on git history in their build process. pip/src/pip/_internal/vcs/git.py Lines 274 to 280 in 4204359
Perhaps the |
And even that optimization broke some people's build process: #10652 |
Thanks @notatallshaw, indeed I did not consider those kinds of builds. I guess some flag to enable "unsafe" optimizations is out of the question, right?
We could query the repository for the existence of a branch with the given name. However, this would not solve the which compelled me to open the issue, which is more about the history than the number of branches. |
I don't think it's "out of the question", but I do think it's a question of complexity vs. benefit, if it's not the default behavior of pip it doesn't add significant benefit, so the complexity should be very low. I'll reopen this ticket with it being the idea of adding a "non-default" optimization, but I don't know how much traction it will get with pip maintainers. |
What's the problem this feature will solve?
pip install git+...@foo-branch
clones the whole repository and then checks outfoo-branch
. This process takes some time if the repository has a long history or many branches.Describe the solution you'd like
I'd like to leverage
git clone
parameters to make the whole thing faster when a specific branch is requested. In particular, I'd use `the following:--branch foo-branch
--depth 1
Alternative Solutions
The current solution works fine, but is slow in some specific situations.
Additional context
https://git-scm.com/docs/git-clone
Code of Conduct
The text was updated successfully, but these errors were encountered: