Repository navigation
Conversation
…d request. I call UploadObject with an Uploadable instead of an object reference. This gives me access to the blob's original file name. It's cleaner to add the parent object that already contains the information rather than passing through another individual variable
-Object ID -Original file name -Git branch -Git ref Adding these headers will benefit smart remote repositories and will help improve BLOB management and tracking
|
Nice idea, but I prefer adding it to the batch api json document as suggested in #845. Why would you want this on the storage upload requests, and not the batch API? LFS was designed to use a custom LFS API against a potentially generic storage backend (such as S3), which would ignore the extra headers. Would implementing #845 be enough, or do you need these headers? Calling Super nitpicky: the |
There was a problem hiding this comment.
This is the type of error collecting thing that the commands package should take care of. The lfs package is more of a library with functions that should bubble errors up. The commands package is the CLI layer that prints and logs errors.
There was a problem hiding this comment.
I understand. My reason for doing this was thinking that the headers are not critical to the operation, so the operation shouldn't fail if any problems come up.
There was a problem hiding this comment.
We have a tracerx package that logs stuff if you have pass GIT_TRACE=1 to git lfs. This actually piggy backs on a core git feature, so running with git tracing on will show you all kinds of stuff :)
|
Thanks for the feedback, you're right. It's more fitting in the batch API. I'd still like to have this feature, so if I understand you correctly you'd like to:
Should I close this and open a new pull request? |
👍 If you could update the batch api docs to go with it, that'd be cool too. Depends how involved you want to get with the project. Also, as you're messing around in the lfs client code, there IS an issue focused on cleaning it up: #779. So, don't hesitate to call out anything gross or weird.
You're welcome to do whatever you're most comfortable with. If it was me, I'd just keep hacking on this PR. I appreciate you taking the time to dig in! Feel free to jump in chat if you want to talk. It's a very low volume channel, especially during a US holiday week like this week :) |
|
Cheers, I'll get right on it. |
# Conflicts: # lfs/client.go
…the name instead in each object of the batch API json payload.
…the batch API json payload
|
OK, so I've shuffled things around and now each object of the batch request will contain the original file name and the batch request itself will contain the git revision. So now I'd like to resolve and pass down the current branch. Assuming I'm at |
There was a problem hiding this comment.
I wonder if we should introduce some kind struct here instead?
type BatchRequest struct {
Operation string
Rev string
}
// example pseudo code
ref, _ := git.CurrentRef()
req := lfs.NewRequest("download", objects)
req.Ref = ref.Name
lfs.Batch(req)
Probably call Getting the filename may be tricky though. It'd have to come from // example
u, _ := lfs.NewUploadable(pointer.Oid, pointer.Name)
// it is possible for a single pointer to match multiple filenames
u.Filenames = pointer.Filenames |
|
So yeah I've actually got the file name from the pointer and I enter it into each individual object so that's fine. |
…into a new struct TransferMetadata instead of polluting the call stack with these individual parameters. Also added helper methods "newDownloadTransferMetadata" and "newUploadTransferMetadata" for creating the new struct
|
OK I think I nailed it. Added a new struct object |
…oad operations * Clarifying the names of the TransferMetadata * Pass all TransferMetadata object by value and not by pointer
|
Done and done |
|
Though it's possible I don't think I've come across many instances of that case (local branch name != remote branch name) out in the wild , but I agree that it's better |
|
'ref' property can be used in Gerrit for branch based permissions, it would create a security hole if it is name of local branch not destination branch :) |
…a and fallback to the local ref if needed.
|
Fixed. Thanks for the feedback @dluksza |
Adding the following metadata headers to the upload request:
Adding these headers will benefit smart remote repositories and will help improve BLOB management and tracking.