mirror of
https://github.com/restic/restic.git
synced 2024-12-26 01:37:12 +00:00
prune: Include ID of all missing blobs in error message
This commit is contained in:
parent
d8b80e9862
commit
08d24ff99e
2 changed files with 9 additions and 4 deletions
|
@ -191,13 +191,18 @@ func pruneRepository(gopts GlobalOptions, repo restic.Repository) error {
|
|||
return err
|
||||
}
|
||||
|
||||
var missingBlobs []restic.BlobHandle
|
||||
for h := range usedBlobs {
|
||||
if _, ok := blobCount[h]; !ok {
|
||||
return errors.Fatalf("At least one data blob seems to be missing, aborting prune to prevent further data loss!\n" +
|
||||
"Please report this error (along with the output of the 'prune' run) at\n" +
|
||||
"https://github.com/restic/restic/issues/new")
|
||||
missingBlobs = append(missingBlobs, h)
|
||||
}
|
||||
}
|
||||
if len(missingBlobs) > 0 {
|
||||
return errors.Fatalf("%v not found in the new index\n"+
|
||||
"Data blobs seem to be missing, aborting prune to prevent further data loss!\n"+
|
||||
"Please report this error (along with the output of the 'prune' run) at\n"+
|
||||
"https://github.com/restic/restic/issues/new/choose", missingBlobs)
|
||||
}
|
||||
|
||||
Verbosef("found %d of %d data blobs still in use, removing %d blobs\n",
|
||||
len(usedBlobs), stats.blobs, stats.blobs-len(usedBlobs))
|
||||
|
|
|
@ -1277,7 +1277,7 @@ func TestPruneWithDamagedRepository(t *testing.T) {
|
|||
if err == nil {
|
||||
t.Fatalf("expected prune to fail")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "blob seems to be missing") {
|
||||
if !strings.Contains(err.Error(), "blobs seem to be missing") {
|
||||
t.Fatalf("did not find hint for missing blobs")
|
||||
}
|
||||
t.Log(err)
|
||||
|
|
Loading…
Reference in a new issue