aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/tree.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2022-11-07 16:55:53 +0100
committerGitHub <noreply@github.com>2022-11-07 16:55:53 +0100
commitf37bb587b6634435afb5069b2101cb4e0ff78d63 (patch)
tree9e6ace8591fff4e95f982304842f0bf8512bd612 /plumbing/object/tree.go
parent652bc83fe45c114440de41d7e0fecf3e4b9e517d (diff)
parenta2c309de872dc18053acb186b1ec125d1f723a90 (diff)
downloadgo-git-f37bb587b6634435afb5069b2101cb4e0ff78d63.tar.gz
Merge pull request #608 from pjbgf/optimise-zlib-reader
Optimise zlib reader and consolidate sync.Pools
Diffstat (limited to 'plumbing/object/tree.go')
-rw-r--r--plumbing/object/tree.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/plumbing/object/tree.go b/plumbing/object/tree.go
index 5e6378c..e9f7666 100644
--- a/plumbing/object/tree.go
+++ b/plumbing/object/tree.go
@@ -1,7 +1,6 @@
package object
import (
- "bufio"
"context"
"errors"
"fmt"
@@ -14,6 +13,7 @@ import (
"github.com/go-git/go-git/v5/plumbing/filemode"
"github.com/go-git/go-git/v5/plumbing/storer"
"github.com/go-git/go-git/v5/utils/ioutil"
+ "github.com/go-git/go-git/v5/utils/sync"
)
const (
@@ -230,9 +230,9 @@ func (t *Tree) Decode(o plumbing.EncodedObject) (err error) {
}
defer ioutil.CheckClose(reader, &err)
- r := bufPool.Get().(*bufio.Reader)
- defer bufPool.Put(r)
- r.Reset(reader)
+ r := sync.GetBufioReader(reader)
+ defer sync.PutBufioReader(r)
+
for {
str, err := r.ReadString(' ')
if err != nil {