From 9abba2664e92831c6ea616f2b5e4f570256f6d92 Mon Sep 17 00:00:00 2001 From: Chris Darroch Date: Mon, 31 Oct 2022 10:30:32 -0700 Subject: [PATCH] commands/uploader.go: update object skip comments In commit 338ab406ba35a0645bc660f8cb24dad8913f9490 of PR #1812 the prepareUpload() function was refactored so that it no longer checked whether an object to be pushed had a local file copy or not and skipped it if it did not. (That functionality already existed in the uploadTransfer() function in that it called the ensureFile() function before returning a tq.Transfer object. Note that these functions were in the commands/commands.go source file at the time. The uploadTransfer() function is called for each pointer blob object by uploadPointers().) However, commit 338ab406ba35a0645bc660f8cb24dad8913f9490 did not update the comment in prepareUpload() which stated that the function skipped any objects which did not have local file copies, so we now revise that comment and add one in the uploadTransfer() function. --- commands/uploader.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/commands/uploader.go b/commands/uploader.go index 215567a5..09393ca8 100644 --- a/commands/uploader.go +++ b/commands/uploader.go @@ -190,8 +190,8 @@ func (c *uploadContext) prepareUpload(unfiltered ...*lfs.WrappedPointer) []*lfs. // scanner uniqOids := tools.NewStringSet() - // separate out objects that _should_ be uploaded, but don't exist in - // .git/lfs/objects. Those will skipped if the server already has them. + // Skip any objects which we've seen or already uploaded, as well + // as any which are locked by other users. for _, p := range unfiltered { // object already uploaded in this process, or we've already // seen this OID (see above), skip! @@ -358,6 +358,8 @@ func (c *uploadContext) uploadTransfer(p *lfs.WrappedPointer) (*tq.Transfer, err return nil, errors.Wrap(err, tr.Tr.Get("Error uploading file %s (%s)", filename, oid)) } + // Skip the object if its corresponding file does not exist in + // .git/lfs/objects/. if len(filename) > 0 { if missing, err = c.ensureFile(filename, localMediaPath, oid); err != nil && !errors.IsCleanPointerError(err) { return nil, err