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

Function pointersToFetch

commands/command_fetch.go:419–451  ·  view source on GitHub ↗
(allPointers []*lfs.WrappedPointer, watcher *fetchWatcher)

Source from the content-addressed store, hash-verified

417}
418
419func pointersToFetch(allPointers []*lfs.WrappedPointer, watcher *fetchWatcher) ([]*lfs.WrappedPointer, *tq.Meter) {
420 logger := tasklog.NewLogger(os.Stdout,
421 tasklog.ForceProgress(cfg.ForceProgress()),
422 )
423 meter := buildProgressMeter(hasToPrintTransfers(), tq.Download)
424 logger.Enqueue(meter)
425
426 pointersToFetch := make([]*lfs.WrappedPointer, 0, len(allPointers))
427
428 for _, p := range allPointers {
429 // if running with --dry-run or --refetch, skip objects that have already been virtually or
430 // already forcefully fetched
431 if watcher != nil && watcher.hasObserved(p.Oid) {
432 continue
433 }
434
435 // empty files are special, we always skip them in upload/download operations
436 if p.Size == 0 {
437 continue
438 }
439
440 // no need to download objects that exist locally already, unless `--refetch` was provided
441 lfs.LinkOrCopyFromReference(cfg, p.Oid, p.Size)
442 if !fetchRefetchArg && cfg.LFSObjectExists(p.Oid, p.Size) {
443 continue
444 }
445
446 pointersToFetch = append(pointersToFetch, p)
447 meter.Add(p.Size)
448 }
449
450 return pointersToFetch, meter
451}
452
453func init() {
454 RegisterCommand("fetch", fetchCommand, func(cmd *cobra.Command) {

Callers 1

fetchFunction · 0.85

Calls 10

EnqueueMethod · 0.95
NewLoggerFunction · 0.92
ForceProgressFunction · 0.92
LinkOrCopyFromReferenceFunction · 0.92
buildProgressMeterFunction · 0.85
hasToPrintTransfersFunction · 0.85
ForceProgressMethod · 0.80
hasObservedMethod · 0.80
LFSObjectExistsMethod · 0.80
AddMethod · 0.65

Tested by

no test coverage detected