diff --git a/cmd/restic/cmd_check.go b/cmd/restic/cmd_check.go index 5018a05a2..b5d971f06 100644 --- a/cmd/restic/cmd_check.go +++ b/cmd/restic/cmd_check.go @@ -249,7 +249,7 @@ func runCheck(ctx context.Context, opts CheckOptions, gopts GlobalOptions, args if len(args) > 0 || !opts.SnapshotFilter.Empty() { snapshotLister, err := restic.MemorizeList(ctx, repo, restic.SnapshotFile) if err != nil { - return err + return summary, err } err = (&opts.SnapshotFilter).FindAll(ctx, snapshotLister, repo, args, func(_ string, sn *restic.Snapshot, err error) error { @@ -262,10 +262,10 @@ func runCheck(ctx context.Context, opts CheckOptions, gopts GlobalOptions, args }) if err != nil { - return err + return summary, err } if len(selectedTrees) == 0 { - return errors.Fatal("snapshotfilter active but no snapshot selected.") + return summary, errors.Fatal("snapshotfilter active but no snapshot selected.") } } @@ -282,21 +282,6 @@ func runCheck(ctx context.Context, opts CheckOptions, gopts GlobalOptions, args return summary, ctx.Err() } - if len(args) > 0 { - snapshotLister, err := restic.MemorizeList(ctx, repo, restic.SnapshotFile) - if err != nil { - return summary, err - } - - // run down the tree, take note of the data packfiles involved - for sn := range FindFilteredSnapshots(ctx, snapshotLister, repo, &opts.SnapshotFilter, args) { - err := chkr.FindDataPackfiles(ctx, repo, sn) - if err != nil { - return summary, err - } - } - } - errorsFound := false for _, hint := range hints { switch hint.(type) { @@ -417,7 +402,7 @@ func runCheck(ctx context.Context, opts CheckOptions, gopts GlobalOptions, args if len(selectedTrees) > 0 { err = chkr.CheckWithSnapshots(ctx, selectedTrees) if err != nil { - return err + return summary, err } filterBySnapshot = true }