@@ -11,6 +11,9 @@ import (
11
11
"math"
12
12
"strconv"
13
13
"strings"
14
+
15
+ "github.com/djherbis/buffer"
16
+ "github.com/djherbis/nio/v3"
14
17
)
15
18
16
19
// WriteCloserError wraps an io.WriteCloser with an additional CloseWithError function
@@ -23,7 +26,7 @@ type WriteCloserError interface {
23
26
func CatFileBatchCheck (repoPath string ) (WriteCloserError , * bufio.Reader , func ()) {
24
27
25
28
batchStdinReader , batchStdinWriter := io .Pipe ()
26
- batchStdoutReader , batchStdoutWriter := io .Pipe ()
29
+ batchStdoutReader , batchStdoutWriter := nio .Pipe (buffer . New ( 4 * 1024 ) )
27
30
cancel := func () {
28
31
_ = batchStdinReader .Close ()
29
32
_ = batchStdinWriter .Close ()
@@ -43,7 +46,7 @@ func CatFileBatchCheck(repoPath string) (WriteCloserError, *bufio.Reader, func()
43
46
}
44
47
}()
45
48
46
- // For simplicities sake we'll us a buffered reader to read from the cat-file --batch
49
+ // For simplicities sake we'll use a buffered reader to read from the cat-file --batch-check
47
50
batchReader := bufio .NewReader (batchStdoutReader )
48
51
49
52
return batchStdinWriter , batchReader , cancel
@@ -54,7 +57,7 @@ func CatFileBatch(repoPath string) (WriteCloserError, *bufio.Reader, func()) {
54
57
// We often want to feed the commits in order into cat-file --batch, followed by their trees and sub trees as necessary.
55
58
// so let's create a batch stdin and stdout
56
59
batchStdinReader , batchStdinWriter := io .Pipe ()
57
- batchStdoutReader , batchStdoutWriter := io .Pipe ()
60
+ batchStdoutReader , batchStdoutWriter := nio .Pipe (buffer . New ( 32 * 1024 ) )
58
61
cancel := func () {
59
62
_ = batchStdinReader .Close ()
60
63
_ = batchStdinWriter .Close ()
0 commit comments