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
1 changed files with 3 additions and 1 deletions

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 {