-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Dluksza include ref in upload request #1036
Conversation
Adds "ref" parameter extracted from git pre-push hook into the upload request. This way servers with branch access permissions can enforce them before large objects are transfered. Issue: #845
In push hook refs comes from user and points to local branches. Transporting them to server doesn't make sense.
Don't add empty "ref" parameter to the lfs-request object when its value is empty.
Instead of passing around additional string parameter with destination ref, we pass special struct called UploadMetadata. For now UploadMetadata contains only ref field but in the future more metadata like file name (or path) can be added.
Move "ref" property of batch request into "meta" object, this way all meta data have a common place to live instead of being spread all around the batch request.
Since we also want to have metadata included in fetch request the UploadMetadata struct is renamed to TransferMetadata. Patch that adds metadata to fetch request will follow.
Include meta.ref property in download request object, same as it is in the upload request. In case of download meta.ref contain name of currently check out local branch and can be only a suggestion to server implementation.
Normalize the value of meta.ref parameter of batch request object. Previously ref parameter format differs between "download" and "upload" objects. The "upload" always was using the fully qualified branch name (eg. refs/heads/master), when the "download" used short name (eg. master). Right now meta.ref will have consistent values. When "refs/heads/" prefix will be appended when it is not present. Special "HEAD" reference will be replaced with empty string, which will result in meta.ref parameter not being included in the request object.
Echoing @sinbad's comments in #969 (comment):
I'm sure it's not intentional. The None of the I think |
Instead of using |
I assume you're talking about |
No, all code paths just build up a list of lfs pointers first, before uploading. https://github.com/github/git-lfs/blob/master/commands/command_push.go#L55-L74 The pre-push command relies on the transfer queue's You're right that it does send the OIDs to the batch api multiple times, potentially. But it doesn't transfer the same one multiple times in a single command. We could probably solve this by tracking the successful uploads, and preventing them from being added to another ref's transfer queue. |
I made a few code spikes that illustrate how we could refactor those commands. #1038 changes |
Wow, this is a major yak shave :/ Redoing this in #1128.... |
Re-applied #969 against the current master, fixing some merge conflicts.