(allPointers []*lfs.WrappedPointer, watcher *fetchWatcher)
| 417 | } |
| 418 | |
| 419 | func 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 | |
| 453 | func init() { |
| 454 | RegisterCommand("fetch", fetchCommand, func(cmd *cobra.Command) { |
no test coverage detected