aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/packfile/patch_delta.go
diff options
context:
space:
mode:
authorJavi Fontan <jfontan@gmail.com>2018-07-24 17:36:21 +0200
committerJavi Fontan <jfontan@gmail.com>2018-07-26 14:17:56 +0200
commita716126aa7f9b77030d2e697db24d206d944f05d (patch)
tree15122d19ae4de9f068e135f92b144a0580e2f63d /plumbing/format/packfile/patch_delta.go
parent65e8359db00ae79838d19e19f69594f6a262c3d4 (diff)
downloadgo-git-a716126aa7f9b77030d2e697db24d206d944f05d.tar.gz
plumbing/packfile: preallocate memory in PatchDelta
Signed-off-by: Javi Fontan <jfontan@gmail.com>
Diffstat (limited to 'plumbing/format/packfile/patch_delta.go')
-rw-r--r--plumbing/format/packfile/patch_delta.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/plumbing/format/packfile/patch_delta.go b/plumbing/format/packfile/patch_delta.go
index c604851..a972f1c 100644
--- a/plumbing/format/packfile/patch_delta.go
+++ b/plumbing/format/packfile/patch_delta.go
@@ -63,8 +63,8 @@ func PatchDelta(src, delta []byte) ([]byte, error) {
targetSz, delta := decodeLEB128(delta)
remainingTargetSz := targetSz
- var dest []byte
var cmd byte
+ dest := make([]byte, 0, targetSz)
for {
if len(delta) == 0 {
return nil, ErrInvalidDelta