Hash out a config value, default to 3 for now

This commit is contained in:
rubyist 2015-04-23 10:48:44 -04:00
parent 88b5de3f1b
commit 7fcdb6c992
2 changed files with 15 additions and 1 deletions

@ -110,7 +110,7 @@ func pushCommand(cmd *cobra.Command, args []string) {
Panic(err, "Error scanning for Git LFS files")
}
uploadQueue := lfs.NewUploadQueue(3)
uploadQueue := lfs.NewUploadQueue(lfs.Config.ConcurrentUploads())
for i, pointer := range pointers {
if dryRun {

@ -8,6 +8,7 @@ import (
"os"
"path"
"regexp"
"strconv"
"strings"
"sync"
)
@ -69,6 +70,19 @@ func (c *Configuration) Endpoint() Endpoint {
return c.RemoteEndpoint(defaultRemote)
}
func (c *Configuration) ConcurrentUploads() int {
uploads := 3
if v, ok := c.GitConfig("lfs.concurrentuploads"); ok {
n, err := strconv.Atoi(v)
if err == nil {
uploads = n
}
}
return uploads
}
func (c *Configuration) RemoteEndpoint(remote string) Endpoint {
if len(remote) == 0 {
remote = defaultRemote