From 6408686973bfcd24ee7a716c5793f29cb6af2056 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sun, 13 Feb 2022 16:50:50 +0100 Subject: [PATCH] repository: Simplify Blob equality check --- internal/checker/checker.go | 2 +- internal/repository/index.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/checker/checker.go b/internal/checker/checker.go index c2a900420..8b5676050 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -542,7 +542,7 @@ func checkPack(ctx context.Context, r restic.Repository, id restic.ID, blobs []r // Check if blob is contained in index and position is correct idxHas := false for _, pb := range idx.Lookup(blob.BlobHandle) { - if pb.PackID == id && pb.Offset == blob.Offset && pb.Length == blob.Length { + if pb.PackID == id && pb.Blob == blob { idxHas = true break } diff --git a/internal/repository/index.go b/internal/repository/index.go index fdd57b052..3db19b3b8 100644 --- a/internal/repository/index.go +++ b/internal/repository/index.go @@ -543,7 +543,7 @@ func (idx *Index) merge(idx2 *Index) error { m.foreachWithID(e2.id, func(e *indexEntry) { b := idx.toPackedBlob(e, restic.BlobType(typ)) b2 := idx2.toPackedBlob(e2, restic.BlobType(typ)) - if b.Length == b2.Length && b.Offset == b2.Offset && b.PackID == b2.PackID { + if b == b2 { found = true } })