Add Git LFS support to uv-git
crate
#10335
Open
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.
Summary
Closes #3312.
This PR adds Git LFS support to the
uv-git
crate by using thegit-lfs
CLI to fetch required LFS objects for a revision following the call togit fetch
.The LFS fetch step is run for all repositories regardless of whether they have associated LFS objects. The step is skipped if the
git-lfs
CLI tool isn't installed.As described in the linked issue, this may introduce overhead in the case where a user has Git LFS installed and is trying to clone a very large repository that doesn't use LFS, but my guess is that it shouldn't be an issue.
Test Plan
I verified that the minimal example in the linked issue passes, i.e. this command now succeeds:
I also verified that non-LFS repositories still work, with or without
git-lfs
installed.Potential Changes / Improvements
With this change LFS objects in a given revision will always be downloaded if the user has Git LFS installed, which may not always be desired behavior. It might be helpful to add a field to the
uv
settings and/or an environment variable so that the LFS step can be disabled if needed.