2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-26 20:30:19 +00:00

forget: Run prune for manually forgotten snapshots

This commit is contained in:
Alexander Neumann 2017-10-03 11:56:13 +02:00
parent abe6e0d22d
commit 034b0b8040

View File

@ -116,6 +116,8 @@ func runForget(opts ForgetOptions, gopts GlobalOptions, args []string) error {
}
}
removeSnapshots := 0
ctx, cancel := context.WithCancel(gopts.ctx)
defer cancel()
for sn := range FindFilteredSnapshots(ctx, repo, opts.Host, opts.Tags, opts.Paths, args) {
@ -127,6 +129,7 @@ func runForget(opts ForgetOptions, gopts GlobalOptions, args []string) error {
return err
}
Verbosef("removed snapshot %v\n", sn.ID().Str())
removeSnapshots++
} else {
Verbosef("would have removed snapshot %v\n", sn.ID().Str())
}
@ -178,7 +181,6 @@ func runForget(opts ForgetOptions, gopts GlobalOptions, args []string) error {
return nil
}
removeSnapshots := 0
for k, snapshotGroup := range snapshotGroups {
var key key
if json.Unmarshal([]byte(k), &key) != nil {