diff options
author | Nikolay Edigaryev <edigaryev@gmail.com> | 2024-07-20 15:33:46 +0400 |
---|---|---|
committer | Nikolay Edigaryev <edigaryev@gmail.com> | 2024-07-20 15:35:43 +0400 |
commit | fd40610a258675dfe4146d9e857d3217e7ca3724 (patch) | |
tree | 4f6da65dd113e46b3f962da09750690b5ce9369d /plumbing/format/packfile | |
parent | ec133065ea1201a4488bbc793ccd9337b6c06877 (diff) | |
download | go-git-fd40610a258675dfe4146d9e857d3217e7ca3724.tar.gz |
plumbing: format/packfile, remove duplicate checks in findMatch()
Diffstat (limited to 'plumbing/format/packfile')
-rw-r--r-- | plumbing/format/packfile/delta_index.go | 20 |
1 files changed, 9 insertions, 11 deletions
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 } |