Skip to content

Commit

Permalink
Merge pull request go-git#1152 from edigaryev/remove-duplicate-checks
Browse files Browse the repository at this point in the history
plumbing: format/packfile, remove duplicate checks in findMatch()
  • Loading branch information
pjbgf authored Jul 31, 2024
2 parents 9debed2 + 3a3f96c commit 61f8d68
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions plumbing/format/packfile/delta_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
return
}

srcOffset = idx.entries[eIdx]

l = matchLength(src, tgt, tgtOffset, srcOffset)

return
}

Expand Down

0 comments on commit 61f8d68

Please sign in to comment.