forked from TrueCloudLab/restic
Merge pull request #3767 from MichaelEischer/fix-prune-empty-snapshot
prune: Fix crash on snapshot loading error
This commit is contained in:
commit
74f7fe2b98
1 changed files with 3 additions and 2 deletions
|
@ -621,15 +621,16 @@ func getUsedBlobs(gopts GlobalOptions, repo restic.Repository, ignoreSnapshots r
|
||||||
Verbosef("loading all snapshots...\n")
|
Verbosef("loading all snapshots...\n")
|
||||||
err = restic.ForAllSnapshots(gopts.ctx, repo.Backend(), repo, ignoreSnapshots,
|
err = restic.ForAllSnapshots(gopts.ctx, repo.Backend(), repo, ignoreSnapshots,
|
||||||
func(id restic.ID, sn *restic.Snapshot, err error) error {
|
func(id restic.ID, sn *restic.Snapshot, err error) error {
|
||||||
debug.Log("add snapshot %v (tree %v, error %v)", id, *sn.Tree, err)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
debug.Log("failed to load snapshot %v (error %v)", id, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
debug.Log("add snapshot %v (tree %v)", id, *sn.Tree)
|
||||||
snapshotTrees = append(snapshotTrees, *sn.Tree)
|
snapshotTrees = append(snapshotTrees, *sn.Tree)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, errors.Fatalf("failed loading snapshot: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
Verbosef("finding data that is still in use for %d snapshots\n", len(snapshotTrees))
|
Verbosef("finding data that is still in use for %d snapshots\n", len(snapshotTrees))
|
||||||
|
|
Loading…
Reference in a new issue