make Lookup() return all blobs

+ simplify syntax
This commit is contained in:
Alexander Weiss
2020-06-14 13:26:10 +02:00
committed by Michael Eischer
parent 020cab8e08
commit 9d1fb94c6c
13 changed files with 134 additions and 72 deletions

View File

@@ -165,8 +165,7 @@ func runCat(gopts GlobalOptions, args []string) error {
case "blob":
for _, t := range []restic.BlobType{restic.DataBlob, restic.TreeBlob} {
_, found := repo.Index().Lookup(id, t)
if !found {
if !repo.Index().Has(id, t) {
continue
}

View File

@@ -465,8 +465,8 @@ func (f *Finder) findObjectPack(ctx context.Context, id string, t restic.BlobTyp
return
}
blobs, found := idx.Lookup(rid, t)
if !found {
blobs := idx.Lookup(rid, t)
if len(blobs) == 0 {
Printf("Object %s not found in the index\n", rid.Str())
return
}