From 42013d681c2527dce3e13a3289e1f48e8705d905 Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Wed, 8 Apr 2015 16:53:20 +0200 Subject: [PATCH] fix the progress bar output by calling Finish() [master 6bc3a3b] booya 1 file changed, 1 insertion(+), 1 deletion(-) Uploading test1.dat (19.07 MB) 19.07 MB / 19.07 MB 100.00 % Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 363 bytes | 0 bytes/s, done. Total 3 (delta 1), reused 0 (delta 0) --- commands/command_push.go | 7 +++++++ lfs/client.go | 1 + 2 files changed, 8 insertions(+) diff --git a/commands/command_push.go b/commands/command_push.go index 2a8451a1..ff88837e 100644 --- a/commands/command_push.go +++ b/commands/command_push.go @@ -2,6 +2,7 @@ package commands import ( "fmt" + "github.com/cheggaaa/pb" "github.com/github/git-lfs/git" "github.com/github/git-lfs/lfs" "github.com/github/git-lfs/pointer" @@ -137,6 +138,11 @@ func pushAsset(oid, filename string, index, totalFiles int) *lfs.WrappedError { return lfs.Errorf(err, "Error uploading file %s (%s)", filename, oid) } + stat, err := os.Stat(filename) + if err != nil { + return lfs.Errorf(err, "Error uploading file %s (%s)", filename, oid) + } + cb, file, cbErr := lfs.CopyCallbackFile("push", filename, index, totalFiles) if cbErr != nil { Error(cbErr.Error()) @@ -146,6 +152,7 @@ func pushAsset(oid, filename string, index, totalFiles int) *lfs.WrappedError { defer file.Close() } + fmt.Fprintf(os.Stderr, "Uploading %s (%s)\n", filename, pb.FormatBytes(stat.Size())) return lfs.Upload(path, filename, cb) } diff --git a/lfs/client.go b/lfs/client.go index be0a3c80..a7dbc9a4 100644 --- a/lfs/client.go +++ b/lfs/client.go @@ -192,6 +192,7 @@ func Upload(oidPath, filename string, cb CopyCallback) *WrappedError { req.Body = ioutil.NopCloser(bar.NewProxyReader(reader)) res, wErr = doHttpRequest(req, creds) + bar.Finish() if wErr != nil { return wErr }