Repository navigation
Check server for objects before failing push because local is missing - #581
Conversation
…iable in batch mode In batch mode you don't get an error from a missing Check(), you just get a lack of download link (get an upload link instead). Therefore the only reliable way to judge whether Check() worked is to check the transfer chan. Also add tests for batch mode to prove this works
|
Looks good to me 👍 What do folks thing about embedding a type Checkable struct {
Pointer *WrappedPointer
object *objectResource
*Downloadable
}
func NewCheckable(p *WrappedPointer) *Checkable {
return &Checkable{Pointer: p, Downloadable: NewDownloadable(p)}
}
func (d *Checkable) Transfer(cb CopyCallback) *WrappedError {
// just report completion of check but don't do anything
cb(d.Size(), d.Size(), int(d.Size()))
return nil
}While we don't technically need |
That's cool but feels a bit funky having Checkable include a more specific type. I think it would make more sense conceptually to do the reverse and embed a Checkable in Downloadable? |
It depends how you look at it. Is Downloadable embedding Checkable to add new functionality, or is Checkable embedding Downloadable to disable functionality? I think it makes sense for both Downloadable and Uploadable to embed a Checkable. |
|
I think Checkable as the base makes the most sense. I'm also not opposed to keeping it as it is, just wondering aloud kind of thing. |
There was a problem hiding this comment.
This duplication seems unnecessary. Can we get away with changing the action key from "upload" to "download" based on the bool return value from largeObjects.Get()?
Renamed Checkable to DownloadCheckable because it only applies to download, upload checks differently and uses different struct fields. Incorporated with download_queue.go since code is now smaller & common.
Yeah this was a good point to make. On reflection I've renamed it DownloadCheckable because the check is specific to download, and the upload check is different (and Uploadable uses a different field structure so there's no re-use). Downloadable now just embeds DownloadCheckable and overrides Transfer(). |
|
Hrm, random failure in checkout test on Travis when it works fine here... |
|
I discovered I can re-run the Travis test on my own fork (I can't here) and it passed at the same commit. https://travis-ci.org/sinbad/git-lfs/builds/75401728 |
|
Any chance you can re-run the Travis check on this PR please? I think it's bogus (see previous comment, same commit tested fine in my fork). |
|
Passed! |
…rver Check server for objects before failing push because local is missing
The local client doesn't have all the LFS objects so it's perfectly valid to push commits which reference objects that don't exist, so long as the server already has them. This could occur when deleting files and pushing new branches (#564) but is increasingly likely as fetch & prune functionality is introduced.
So now we perform a pre-check and any locally missing files are checked on the server. To gain the benefit of the existing parallelism and batching API this required adding a new type of transferable which only checks for download, and doesn't actually do it - instead the fact that the transfer would go ahead is used as an indicator that this oid can be skipped when it comes to push & therefore not cause the process to fail.
After merging this PR it's safe to merge #573 (which deliberately doesn't download all LFS objects).