mirror of https://github.com/restic/restic.git
check: harmonize my branch with master - integrate checkSummary
based on the change in runCheck return values the following functions have been afftected cmd/restic/cmd_check_integration_test.go cmd/restic/cmd_migrate.go cmd/restic/cmd_prune_integration_test.go cmd/restic/integration_test.go check - corrected rebase error by not removing obsolete code. the check for the filter if len(args) > 0 { ... } is obsolete and has been replaced by if len(args) > 0 || !opts.SnapshotFilter.Empty() { ... }
This commit is contained in:
parent
7fe83f0db0
commit
b5c371892b
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue