-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Support fetching entire history of specific refs #3849
Support fetching entire history of specific refs #3849
Conversation
As I now realized, I believe that my suggested change to
|
Hey, This seems to be a nice improvement, and I agree that it mirrors |
@bk2204: Thanks a lot, this is exactly the kind of feedback I was looking for before proceeding with integration tests and documentation. I’ll make this pull request ready for review, or I’ll let you know if I have questions. |
This adds support for combining the --all option with refs specified as positional command-line arguments. This will download all objects referenced by any commit reachable from any of the specified refs. The purpose of this is to be able to perform full backups, migrations, or mirroring operations of only a specific set of refs.
This adds test covering the usage of git lfs fetch with the --all option in combination with a list of refs specified as positional arguments, both for regular and bare repositories.
@bk2204: I’ve updated the documentation to match the new behavior of I wouldn’t mind if someone had a look at my changes now 🙂. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great; I think there's just one or two documentation issues to fix.
@bk2204: Thanks a lot for your feedback, I’ve fixed the two documentation issues that you spotted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. I'll wait for this to pass on Windows, and then merge.
Motivation
I’m currently working on an automation that synchronizes Git repositories between remotes, some of which use Git LFS. Compared to
git lfs fetch --all
, I’d like to fetch all objects referenced in the entire commit history but, and here comes the difference, not for all refs but only a specific set of refs.For this reason, I’d like extend
git lfs fetch
to support downloading all objects referenced by any commit reachable from a user-defined set of refs.Design
I suggest allowing
git lfs fetch
to accept a combination of the--all
option and a list of refs specified as positional command-line arguments. This would then instruct Git LFS to download all objects referenced by any commit reachable from any of the specified refs (but no other objects).For example, the call
would download all objects referenced by any commit in the
master
anddevelop
branches as well as thev1.0.0
tag—not just the tips of those branches and tags. However, objects stemming from asandbox
branch or av0.1.0
tag would not be downloaded if they aren’t contained inmaster
,develop
, orv1.0.0
.In contrast,
only downloads objects referenced by the tips of
master
,develop
, andv1.0.0
but none of the objects from earlier commits.Implementation
I based the implementation off the preexisting functions used when providing the
--all
option and when providing just a list of refs without--all
. I’ve added tests covering the new usage of the--all
option to show that indeed only objects referenced by commits reachable from the requested refs (but none aside from those) will be fetched.