mirror of
https://github.com/restic/restic.git
synced 2025-12-15 18:12:25 +00:00
Make realistic forget --prune --dryrun
This commit is contained in:
committed by
Alexander Neumann
parent
7f9a0a5907
commit
b2f5381737
@@ -214,9 +214,8 @@ func runForget(opts ForgetOptions, gopts GlobalOptions, args []string) error {
|
||||
if !gopts.JSON {
|
||||
Verbosef("%d snapshots have been removed, running prune\n", len(removeSnIDs))
|
||||
}
|
||||
|
||||
pruneOptions.DryRun = opts.DryRun
|
||||
return runPruneWithRepo(pruneOptions, gopts, repo)
|
||||
return runPruneWithRepo(pruneOptions, gopts, repo, removeSnIDs)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -128,15 +128,15 @@ func runPrune(opts PruneOptions, gopts GlobalOptions) error {
|
||||
return err
|
||||
}
|
||||
|
||||
return runPruneWithRepo(opts, gopts, repo)
|
||||
return runPruneWithRepo(opts, gopts, repo, restic.NewIDSet())
|
||||
}
|
||||
|
||||
func runPruneWithRepo(opts PruneOptions, gopts GlobalOptions, repo *repository.Repository) error {
|
||||
func runPruneWithRepo(opts PruneOptions, gopts GlobalOptions, repo *repository.Repository, ignoreSnapshots restic.IDSet) error {
|
||||
// we do not need index updates while pruning!
|
||||
repo.DisableAutoIndexUpdate()
|
||||
|
||||
Verbosef("loading all snapshots...\n")
|
||||
snapshots, err := restic.LoadAllSnapshots(gopts.ctx, repo)
|
||||
snapshots, err := restic.LoadAllSnapshots(gopts.ctx, repo, ignoreSnapshots)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user