Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 61f8d68

Browse files
authored
Merge pull request #1152 from edigaryev/remove-duplicate-checks
plumbing: format/packfile, remove duplicate checks in findMatch()
2 parents 9debed2 + 3a3f96c commit 61f8d68

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

plumbing/format/packfile/delta_index.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,17 @@ func (idx *deltaIndex) findMatch(src, tgt []byte, tgtOffset int) (srcOffset, l i
3232
return 0, -1
3333
}
3434

35-
if len(tgt) >= tgtOffset+s && len(src) >= blksz {
36-
h := hashBlock(tgt, tgtOffset)
37-
tIdx := h & idx.mask
38-
eIdx := idx.table[tIdx]
39-
if eIdx != 0 {
40-
srcOffset = idx.entries[eIdx]
41-
} else {
42-
return
43-
}
44-
45-
l = matchLength(src, tgt, tgtOffset, srcOffset)
35+
h := hashBlock(tgt, tgtOffset)
36+
tIdx := h & idx.mask
37+
eIdx := idx.table[tIdx]
38+
if eIdx == 0 {
39+
return
4640
}
4741

42+
srcOffset = idx.entries[eIdx]
43+
44+
l = matchLength(src, tgt, tgtOffset, srcOffset)
45+
4846
return
4947
}
5048

0 commit comments

Comments
 (0)