mirror of
https://github.com/restic/restic.git
synced 2026-10-06 02:40:31 +00:00
Fix broken snapshots via restic repair snapshots --forget (#21907)
Co-authored-by: Michael Eischer <michael.eischer@fau.de>
This commit is contained in:
co-authored by
Michael Eischer
parent
aa94be2dbd
commit
9e1a526611
@@ -132,6 +132,11 @@ func (f *SnapshotFilter) FindAll(ctx context.Context, be restic.Lister, loader r
|
||||
var err error
|
||||
usedFilter := false
|
||||
|
||||
be, err := restic.MemorizeList(ctx, be, restic.SnapshotFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ids := restic.NewIDSet()
|
||||
// Process all snapshot IDs given as arguments.
|
||||
for _, s := range snapshotIDs {
|
||||
@@ -181,14 +186,18 @@ func (f *SnapshotFilter) FindAll(ctx context.Context, be restic.Lister, loader r
|
||||
if !usedFilter && !f.Empty() {
|
||||
return fn("filters", nil, errors.Errorf("explicit snapshot ids are given"))
|
||||
}
|
||||
return nil
|
||||
return ctx.Err()
|
||||
}
|
||||
|
||||
return ForAllSnapshots(ctx, be, loader, nil, func(id restic.ID, sn *Snapshot, err error) error {
|
||||
err := ForAllSnapshots(ctx, be, loader, nil, func(id restic.ID, sn *Snapshot, err error) error {
|
||||
if err == nil && !f.matches(sn) {
|
||||
return nil
|
||||
}
|
||||
|
||||
return fn(id.String(), sn, err)
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return ctx.Err()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user