Merge pull request #4117 from MichaelEischer/prune-dry-run-help

prune: make it clearer when prune is used in dry-run mode
This commit is contained in:
Michael Eischer 2023-01-04 23:18:53 +01:00 committed by GitHub
commit 24178c97e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -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)

View File

@ -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