Use git command to fetch repositories instead of libgit2 for robust SSH support#1781
Merged
Use git command to fetch repositories instead of libgit2 for robust SSH support#1781
git command to fetch repositories instead of libgit2 for robust SSH support#1781Conversation
313c720 to
8e28162
Compare
03a1e07 to
2a5bebe
Compare
8e28162 to
2e4c719
Compare
zanieb
commented
Feb 20, 2024
zanieb
commented
Feb 20, 2024
zanieb
commented
Feb 20, 2024
afafb66 to
188fc0a
Compare
charliermarsh
approved these changes
Feb 21, 2024
snowsignal
approved these changes
Feb 21, 2024
zanieb
commented
Feb 21, 2024
Member
|
Do we have any benchmarks that use git dependencies? Does it change the performance in significant ways? |
# Conflicts: # crates/uv/tests/common/mod.rs
0e99e40 to
5bb19d5
Compare
Member
Author
I don't think we do. Honestly I'm not sure it makes sense to take the time to measure right now because we need to support authentication. I think benchmarking should be done when considering #1786 instead. |
e4925a6 to
7aa6e20
Compare
717169f to
032f637
Compare
This was referenced Feb 21, 2024
zanieb
added a commit
that referenced
this pull request
Feb 22, 2024
Follow-up to #1781 improving the error message when a ref cannot be fetched
charliermarsh
pushed a commit
that referenced
this pull request
Feb 22, 2024
[Rendered](https://github.com/astral-sh/uv/blob/zb/auth-docs/README.md#git-authentication) Adds docs for - #1781 - #1717
ibraheemdev
added a commit
that referenced
this pull request
May 30, 2024
## Summary We currently rely on libgit2 for most git-related functionality. However, libgit2 has long-standing performance issues, as well as lags significantly behind git in terms of new features. For these reasons we now use the git CLI by default for fetching repositories (#1781). This PR completely drops libgit2 in favor of the git CLI for all git-related functionality, which should allow us to use features such as partial clones and sparse checkouts in the future for performance. There is also a lot of technical debt in the current git code as it's mostly taken from Cargo. Switching to the git CLI *vastly* simplifies the `uv-git` codebase. Eventually we might want to look into switching to [`gitoxide`](https://github.com/Byron/gitoxide), but it's currently too immature for our use case.
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.
Closes #1775
Closes #1452
Closes #1514
Follows #1717
libgit2 does not support host names with extra identifiers during SSH lookup (e.g.
github.com-some_identifier) so we use thegitcommand instead for fetching. This is required forpipparity.See the Cargo documentation for more details on using the
gitCLI instead of libgit2. We may want to try to use libgit2 first in the future, as it is more performant (#1786).We now support authentication with:
Tested with a deploy key e.g.
and
with a ssh config like
It seems quite hard to add test coverage for this to the test suite, as we'd need to add the SSH key and I don't know how to isolate that from affecting other developer's machines.