cli: fixed linter issues
@@ -44,7 +44,7 @@ func runMigrateCommand(ctx context.Context, destRepo *repo.Repository) error {
onCtrlC(func() {
mu.Lock()
- mu.Unlock()
+ defer mu.Unlock()
if !cancelled {
cancelled = true
@@ -124,9 +124,20 @@ func migrateSingleSource(ctx context.Context, uploader *snapshotfs.Uploader, sou
if uploader.IsCancelled() {
break
}
+
+ if err := migrateSingleSourceSnapshot(ctx, uploader, sourceRepo, destRepo, s, m); err != nil {
+ return err
+ }
+
+ }
+
+ return nil
+}
+
+func migrateSingleSourceSnapshot(ctx context.Context, uploader *snapshotfs.Uploader, sourceRepo, destRepo *repo.Repository, s snapshot.SourceInfo, m *snapshot.Manifest) error {
if m.IncompleteReason != "" {
log.Infof("ignoring incomplete %v at %v", s, formatTimestamp(m.StartTime))
- continue
+ return nil
}
sourceEntry := snapshotfs.DirectoryEntry(sourceRepo, m.RootObjectID(), nil)
@@ -136,7 +147,7 @@ func migrateSingleSource(ctx context.Context, uploader *snapshotfs.Uploader, sou
}
if existing != nil {
log.Infof("already migrated %v at %v", s, formatTimestamp(m.StartTime))
- continue
+ return nil
}
log.Infof("migrating snapshot of %v at %v", s, formatTimestamp(m.StartTime))
@@ -158,8 +169,6 @@ func migrateSingleSource(ctx context.Context, uploader *snapshotfs.Uploader, sou
return fmt.Errorf("cannot save manifest: %v", err)
}
}
- }
-
return nil
}
