From fd40610a258675dfe4146d9e857d3217e7ca3724 Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Sat, 20 Jul 2024 15:33:46 +0400 Subject: plumbing: format/packfile, remove duplicate checks in findMatch() --- plumbing/format/packfile/delta_index.go | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'plumbing/format/packfile') diff --git a/plumbing/format/packfile/delta_index.go b/plumbing/format/packfile/delta_index.go index 07a6112..b2081c2 100644 --- a/plumbing/format/packfile/delta_index.go +++ b/plumbing/format/packfile/delta_index.go @@ -32,19 +32,17 @@ func (idx *deltaIndex) findMatch(src, tgt []byte, tgtOffset int) (srcOffset, l i return 0, -1 } - if len(tgt) >= tgtOffset+s && len(src) >= blksz { - h := hashBlock(tgt, tgtOffset) - tIdx := h & idx.mask - eIdx := idx.table[tIdx] - if eIdx != 0 { - srcOffset = idx.entries[eIdx] - } else { - return - } - - l = matchLength(src, tgt, tgtOffset, srcOffset) + h := hashBlock(tgt, tgtOffset) + tIdx := h & idx.mask + eIdx := idx.table[tIdx] + if eIdx != 0 { + srcOffset = idx.entries[eIdx] + } else { + return } + l = matchLength(src, tgt, tgtOffset, srcOffset) + return } -- cgit