From 3a3f96c372b0f9a93ea27928baa4516e95a79bde Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Sun, 21 Jul 2024 12:45:00 +0400 Subject: plumbing: format/packfile, early return Co-authored-by: onee-only --- plumbing/format/packfile/delta_index.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'plumbing/format/packfile') diff --git a/plumbing/format/packfile/delta_index.go b/plumbing/format/packfile/delta_index.go index b2081c2..a60ec0b 100644 --- a/plumbing/format/packfile/delta_index.go +++ b/plumbing/format/packfile/delta_index.go @@ -35,12 +35,12 @@ func (idx *deltaIndex) findMatch(src, tgt []byte, tgtOffset int) (srcOffset, l i h := hashBlock(tgt, tgtOffset) tIdx := h & idx.mask eIdx := idx.table[tIdx] - if eIdx != 0 { - srcOffset = idx.entries[eIdx] - } else { + if eIdx == 0 { return } + srcOffset = idx.entries[eIdx] + l = matchLength(src, tgt, tgtOffset, srcOffset) return -- cgit