lfs,commands: remove lfs.NewDownloadable() in favor of commands.downloadTransfer

This commit is contained in:
Taylor Blau 2016-12-15 13:20:41 -07:00
parent 7df1b260fa
commit a73a3c67a8
5 changed files with 11 additions and 18 deletions

@ -327,8 +327,7 @@ func fetchAndReportToChan(allpointers []*lfs.WrappedPointer, filter *filepathfil
for _, p := range pointers {
tracerx.Printf("fetch %v [%v]", p.Name, p.Oid)
d := lfs.NewDownloadable(p)
q.Add(d.Name, d.Path, d.Oid, d.Size)
q.Add(downloadTransfer(p))
}
processQueue := time.Now()

@ -149,10 +149,10 @@ func prune(fetchPruneConfig config.FetchPruneConfig, verifyRemote, dryRun, verbo
if verifyRemote {
tracerx.Printf("VERIFYING: %v", file.Oid)
pointer := lfs.NewPointer(file.Oid, file.Size, nil)
d := lfs.NewDownloadable(&lfs.WrappedPointer{Pointer: pointer})
verifyQueue.Add(d.Name, d.Path, d.Oid, d.Size)
verifyQueue.Add(downloadTransfer(&lfs.WrappedPointer{
Pointer: lfs.NewPointer(file.Oid, file.Size, nil),
}))
}
}
}

@ -67,6 +67,12 @@ func buildFilepathFilter(config *config.Configuration, includeArg, excludeArg *s
return filepathfilter.New(inc, exc)
}
func downloadTransfer(p *lfs.WrappedPointer) (name, path, oid string, size int64) {
path, _ = lfs.LocalMediaPath(p.Oid)
return p.Name, path, p.Oid, p.Size
}
// Error prints a formatted message to Stderr. It also gets printed to the
// panic log if one is created for this command.
func Error(format string, args ...interface{}) {

@ -113,8 +113,7 @@ func (c *uploadContext) checkMissing(missing []*lfs.WrappedPointer, missingSize
}()
for _, p := range missing {
d := lfs.NewDownloadable(p)
checkQueue.Add(d.Name, d.Path, d.Oid, d.Size)
checkQueue.Add(downloadTransfer(p))
}
// Currently this is needed to flush the batch but is not enough to sync

@ -5,17 +5,6 @@ import (
"github.com/git-lfs/git-lfs/tq"
)
func NewDownloadable(p *WrappedPointer) *tq.Transfer {
path, _ := LocalMediaPath(p.Oid)
return &tq.Transfer{
Oid: p.Oid,
Size: p.Size,
Name: p.Name,
Path: path,
}
}
// NewDownloadCheckQueue builds a checking queue, checks that objects are there but doesn't download
func NewDownloadCheckQueue(cfg *config.Configuration, options ...tq.Option) *tq.TransferQueue {
allOptions := make([]tq.Option, len(options), len(options)+1)