From 75d754a561cd13193fca8b560a1d67408b398110 Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Wed, 9 Sep 2015 16:16:26 -0600 Subject: [PATCH] use the channel scanner when pushing ALL objects --- commands/command_push.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/commands/command_push.go b/commands/command_push.go index a1cd9704..9f21493e 100644 --- a/commands/command_push.go +++ b/commands/command_push.go @@ -1,6 +1,7 @@ package commands import ( + "fmt" "io/ioutil" "os" @@ -43,10 +44,23 @@ func uploadsBetweenRefAndRemote(remote string, refs []string) *lfs.TransferQueue if pushAll { if len(refs) == 0 { // no ref given as an arg, so scan all refs - pointers, err := lfs.ScanRefs("", "", scanOpt) + opts := &lfs.ScanRefsOptions{ScanMode: lfs.ScanAllMode, SkipDeletedBlobs: false} + // This could be a long process so use the chan version & report progress + Print("Scanning for all objects ever referenced...") + spinner := lfs.NewSpinner() + var numObjs int64 + pointerchan, err := lfs.ScanRefsToChan("", "", opts) if err != nil { - Panic(err, "Error scanning for all Git LFS files") + Panic(err, "Could not scan for Git LFS files") } + pointers := make([]*lfs.WrappedPointer, 0) + for p := range pointerchan { + numObjs++ + spinner.Print(OutputWriter, fmt.Sprintf("%d objects found", numObjs)) + pointers = append(pointers, p) + } + spinner.Finish(OutputWriter, fmt.Sprintf("%d objects found", numObjs)) + Print("Pushing objects...") return uploadPointers(pointers) } else { scanOpt.ScanMode = lfs.ScanRefsMode