githistory: only download non-cached files

When scanning a tree for pointers, don't download files that
already exist in the cache
This commit is contained in:
Preben Ingvaldsen 2018-06-22 11:48:27 -07:00
parent 159c5fa2e3
commit 3ab80db213

@ -387,7 +387,11 @@ func (r *Rewriter) scanTree(q *tq.TransferQueue, gf *lfs.GitFilter, treeOID []by
return err
}
q.Add(entry.Name, downloadPath, ptr.Oid, ptr.Size)
// Only add files to the transfer queue that aren't already cached
if _, err := os.Stat(downloadPath); os.IsNotExist(err) {
q.Add(entry.Name, downloadPath, ptr.Oid, ptr.Size)
}
case odb.TreeObjectType:
// Scan all subtrees
err = r.scanTree(q, gf, entry.Oid, fullpath)