aboutsummaryrefslogtreecommitdiffstats
path: root/worktree.go
diff options
context:
space:
mode:
Diffstat (limited to 'worktree.go')
-rw-r--r--worktree.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/worktree.go b/worktree.go
index c974aed..98116ca 100644
--- a/worktree.go
+++ b/worktree.go
@@ -534,7 +534,8 @@ func (w *Worktree) checkoutChangeRegularFile(name string,
var copyBufferPool = sync.Pool{
New: func() interface{} {
- return make([]byte, 32*1024)
+ b := make([]byte, 32*1024)
+ return &b
},
}
@@ -561,9 +562,10 @@ func (w *Worktree) checkoutFile(f *object.File) (err error) {
}
defer ioutil.CheckClose(to, &err)
- buf := copyBufferPool.Get().([]byte)
+ bufp := copyBufferPool.Get().(*[]byte)
+ buf := *bufp
_, err = io.CopyBuffer(to, from, buf)
- copyBufferPool.Put(buf)
+ copyBufferPool.Put(bufp)
return
}