diff options
author | Javi Fontan <jfontan@gmail.com> | 2018-07-24 17:36:21 +0200 |
---|---|---|
committer | Javi Fontan <jfontan@gmail.com> | 2018-07-26 14:17:56 +0200 |
commit | a716126aa7f9b77030d2e697db24d206d944f05d (patch) | |
tree | 15122d19ae4de9f068e135f92b144a0580e2f63d /plumbing | |
parent | 65e8359db00ae79838d19e19f69594f6a262c3d4 (diff) | |
download | go-git-a716126aa7f9b77030d2e697db24d206d944f05d.tar.gz |
plumbing/packfile: preallocate memory in PatchDelta
Signed-off-by: Javi Fontan <jfontan@gmail.com>
Diffstat (limited to 'plumbing')
-rw-r--r-- | plumbing/format/packfile/patch_delta.go | 2 |
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 |