mirror of https://github.com/restic/restic.git
fixup! forget: return error if no policy was specified
This commit is contained in:
parent
1ee6255dd2
commit
857f636e5b
|
@ -258,8 +258,8 @@ func runForget(ctx context.Context, opts ForgetOptions, pruneOptions PruneOption
|
|||
|
||||
keep, remove, reasons := restic.ApplyPolicy(snapshotGroup, policy)
|
||||
|
||||
if len(keep) == 0 {
|
||||
return fmt.Errorf("refusing to delete last snapshot of snapshot group %v", key)
|
||||
if !policy.Empty() && len(keep) == 0 {
|
||||
return fmt.Errorf("refusing to delete last snapshot of snapshot group \"%v\"", key.String())
|
||||
}
|
||||
if len(keep) != 0 && !gopts.Quiet && !gopts.JSON {
|
||||
printer.P("keep %d snapshots:\n", len(keep))
|
||||
|
|
Loading…
Reference in New Issue