MCPcopy
hub / github.com/git-lfs/git-lfs / fetch

Function fetch

commands/command_fetch.go:379–417  ·  view source on GitHub ↗

Fetch Returns true if all completed with no errors, false if errors were written to stderr/log

(allPointers []*lfs.WrappedPointer, watcher *fetchWatcher)

Source from the content-addressed store, hash-verified

377// Fetch
378// Returns true if all completed with no errors, false if errors were written to stderr/log
379func fetch(allPointers []*lfs.WrappedPointer, watcher *fetchWatcher) bool {
380 pointersToFetch, meter := pointersToFetch(allPointers, watcher)
381 q := newDownloadQueue(
382 getTransferManifestOperationRemote("download", cfg.Remote()),
383 cfg.Remote(), tq.WithProgress(meter), tq.DryRun(fetchDryRunArg),
384 )
385 var wg sync.WaitGroup
386
387 if watcher != nil {
388 transfers := q.Watch()
389 wg.Add(1)
390 go func() {
391 defer wg.Done()
392 for t := range transfers {
393 watcher.registerTransfer(t)
394 }
395 }()
396 }
397
398 for _, p := range pointersToFetch {
399 tracerx.Printf("fetch %v [%v]", p.Name, p.Oid)
400
401 q.Add(downloadTransfer(p))
402 }
403
404 processQueue := time.Now()
405 q.Wait()
406 tracerx.PerformanceSince("process queue", processQueue)
407
408 ok := true
409 for _, err := range q.Errors() {
410 ok = false
411 FullError(err)
412 }
413 if watcher != nil {
414 wg.Wait()
415 }
416 return ok
417}
418
419func pointersToFetch(allPointers []*lfs.WrappedPointer, watcher *fetchWatcher) ([]*lfs.WrappedPointer, *tq.Meter) {
420 logger := tasklog.NewLogger(os.Stdout,

Callers 4

fetchRefFunction · 0.85
fetchRefsFunction · 0.85
fetchPreviousVersionsFunction · 0.85
fetchAllFunction · 0.85

Calls 14

WithProgressFunction · 0.92
DryRunFunction · 0.92
pointersToFetchFunction · 0.85
newDownloadQueueFunction · 0.85
downloadTransferFunction · 0.85
FullErrorFunction · 0.85
WatchMethod · 0.80
registerTransferMethod · 0.80
ErrorsMethod · 0.80
RemoteMethod · 0.65
AddMethod · 0.65

Tested by

no test coverage detected