From b404ad4eaaddaee2eecea1cd1d2d51d70cd56245 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Fri, 30 Dec 2022 15:01:49 +0100 Subject: [PATCH 1/2] prune: make it clearer when prune is used in dry-run mode --- cmd/restic/cmd_prune.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/restic/cmd_prune.go b/cmd/restic/cmd_prune.go index cb0c67364..6321a947e 100644 --- a/cmd/restic/cmd_prune.go +++ b/cmd/restic/cmd_prune.go @@ -196,6 +196,10 @@ func runPruneWithRepo(ctx context.Context, opts PruneOptions, gopts GlobalOption return err } + if opts.DryRun { + Verbosef("\nWould have made the following changes:") + } + err = printPruneStats(stats) if err != nil { return err From 7a363069017b47a9d74da720fb6e374c94af411e Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Fri, 30 Dec 2022 16:15:03 +0100 Subject: [PATCH 2/2] forget: Clarify log message for `--dry-run --prune` --- cmd/restic/cmd_forget.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/restic/cmd_forget.go b/cmd/restic/cmd_forget.go index f1aef75e3..472b22b79 100644 --- a/cmd/restic/cmd_forget.go +++ b/cmd/restic/cmd_forget.go @@ -237,7 +237,11 @@ func runForget(ctx context.Context, opts ForgetOptions, gopts GlobalOptions, arg if len(removeSnIDs) > 0 && opts.Prune { if !gopts.JSON { - Verbosef("%d snapshots have been removed, running prune\n", len(removeSnIDs)) + if opts.DryRun { + Verbosef("%d snapshots would be removed, running prune dry run\n", len(removeSnIDs)) + } else { + Verbosef("%d snapshots have been removed, running prune\n", len(removeSnIDs)) + } } pruneOptions.DryRun = opts.DryRun return runPruneWithRepo(ctx, pruneOptions, gopts, repo, removeSnIDs)