-
Notifications
You must be signed in to change notification settings - Fork 963
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
Use git
command to fetch repositories instead of libgit2
for robust SSH support
#1781
Conversation
313c720
to
8e28162
Compare
03a1e07
to
2a5bebe
Compare
8e28162
to
2e4c719
Compare
afafb66
to
188fc0a
Compare
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
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
Follow-up to #1781 improving the error message when a ref cannot be fetched
[Rendered](https://github.com/astral-sh/uv/blob/zb/auth-docs/README.md#git-authentication) Adds docs for - #1781 - #1717
## 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.
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 thegit
command instead for fetching. This is required forpip
parity.See the Cargo documentation for more details on using the
git
CLI 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.