diff --git a/cmd/restic/cmd_forget.go b/cmd/restic/cmd_forget.go index 52f325785fea..7df574d34a90 100644 --- a/cmd/restic/cmd_forget.go +++ b/cmd/restic/cmd_forget.go @@ -136,10 +136,11 @@ func init() { } func verifyForgetOptions(opts *ForgetOptions) error { - if opts.Last < -1 || opts.Hourly < -1 || opts.Daily < -1 || opts.Weekly < -1 || - opts.Monthly < -1 || opts.Yearly < -1 { - // TODO: this seem to have no effect. there is a different error message showing up, e.g. for --keep-last -5 - return errors.Fatal("negative values other than -1 are not allowed for --keep-*") + // Negative numbers for these options are not allowed. + if opts.Last < 0 || opts.Hourly < 0 || opts.Daily < 0 || opts.Weekly < 0 || + opts.Monthly < 0 || opts.Yearly < 0 { + // This seem to have no effect though. The condition is already catched in `Set(s string)`, line 44. + return errors.Fatal("negative values are not allowed for --keep-*") } var allKeepWithinXUndefined = true