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)
This commit is contained in:
parent
07d86f587a
commit
42013d681c
@ -2,6 +2,7 @@ package commands
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/cheggaaa/pb"
|
||||||
"github.com/github/git-lfs/git"
|
"github.com/github/git-lfs/git"
|
||||||
"github.com/github/git-lfs/lfs"
|
"github.com/github/git-lfs/lfs"
|
||||||
"github.com/github/git-lfs/pointer"
|
"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)
|
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)
|
cb, file, cbErr := lfs.CopyCallbackFile("push", filename, index, totalFiles)
|
||||||
if cbErr != nil {
|
if cbErr != nil {
|
||||||
Error(cbErr.Error())
|
Error(cbErr.Error())
|
||||||
@ -146,6 +152,7 @@ func pushAsset(oid, filename string, index, totalFiles int) *lfs.WrappedError {
|
|||||||
defer file.Close()
|
defer file.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Fprintf(os.Stderr, "Uploading %s (%s)\n", filename, pb.FormatBytes(stat.Size()))
|
||||||
return lfs.Upload(path, filename, cb)
|
return lfs.Upload(path, filename, cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,6 +192,7 @@ func Upload(oidPath, filename string, cb CopyCallback) *WrappedError {
|
|||||||
req.Body = ioutil.NopCloser(bar.NewProxyReader(reader))
|
req.Body = ioutil.NopCloser(bar.NewProxyReader(reader))
|
||||||
|
|
||||||
res, wErr = doHttpRequest(req, creds)
|
res, wErr = doHttpRequest(req, creds)
|
||||||
|
bar.Finish()
|
||||||
if wErr != nil {
|
if wErr != nil {
|
||||||
return wErr
|
return wErr
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user