aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing')
-rw-r--r--plumbing/format/packfile/patch_delta.go15
1 files changed, 3 insertions, 12 deletions
diff --git a/plumbing/format/packfile/patch_delta.go b/plumbing/format/packfile/patch_delta.go
index 45e589e..7840f17 100644
--- a/plumbing/format/packfile/patch_delta.go
+++ b/plumbing/format/packfile/patch_delta.go
@@ -3,7 +3,6 @@ package packfile
import (
"bytes"
"errors"
- "sync"
"gopkg.in/src-d/go-git.v4/plumbing"
)
@@ -15,12 +14,6 @@ import (
const deltaSizeMin = 4
-var bytesBufferPool = sync.Pool{
- New: func() interface{} {
- return &bytes.Buffer{}
- },
-}
-
// ApplyDelta writes to target the result of applying the modification deltas in delta to base.
func ApplyDelta(target, base plumbing.EncodedObject, delta []byte) error {
r, err := base.Reader()
@@ -33,11 +26,9 @@ func ApplyDelta(target, base plumbing.EncodedObject, delta []byte) error {
return err
}
- buf := bytesBufferPool.Get().(*bytes.Buffer)
- defer func() {
- buf.Reset()
- bytesBufferPool.Put(buf)
- } ()
+ buf := bufPool.Get().(*bytes.Buffer)
+ defer bufPool.Put(buf)
+ buf.Reset()
_, err = buf.ReadFrom(r)
if err != nil {
return err