@@ -8,8 +8,10 @@ import (
8
8
"bufio"
9
9
"bytes"
10
10
"context"
11
+ "fmt"
11
12
"io"
12
13
"math"
14
+ "runtime"
13
15
"strconv"
14
16
"strings"
15
17
@@ -40,9 +42,14 @@ func CatFileBatchCheck(repoPath string) (WriteCloserError, *bufio.Reader, func()
40
42
<- closed
41
43
}
42
44
45
+ _ , filename , line , _ := runtime .Caller (2 )
46
+ filename = strings .TrimPrefix (filename , callerPrefix )
47
+
43
48
go func () {
44
49
stderr := strings.Builder {}
45
- err := NewCommandContext (ctx , "cat-file" , "--batch-check" ).RunInDirFullPipeline (repoPath , batchStdoutWriter , & stderr , batchStdinReader )
50
+ err := NewCommandContext (ctx , "cat-file" , "--batch-check" ).
51
+ SetDescription (fmt .Sprintf ("%s cat-file --batch-check [repo_path: %s] (%s:%d)" , GitExecutable , repoPath , filename , line )).
52
+ RunInDirFullPipeline (repoPath , batchStdoutWriter , & stderr , batchStdinReader )
46
53
if err != nil {
47
54
_ = batchStdoutWriter .CloseWithError (ConcatenateError (err , (& stderr ).String ()))
48
55
_ = batchStdinReader .CloseWithError (ConcatenateError (err , (& stderr ).String ()))
@@ -76,9 +83,14 @@ func CatFileBatch(repoPath string) (WriteCloserError, *bufio.Reader, func()) {
76
83
<- closed
77
84
}
78
85
86
+ _ , filename , line , _ := runtime .Caller (2 )
87
+ filename = strings .TrimPrefix (filename , callerPrefix )
88
+
79
89
go func () {
80
90
stderr := strings.Builder {}
81
- err := NewCommandContext (ctx , "cat-file" , "--batch" ).RunInDirFullPipeline (repoPath , batchStdoutWriter , & stderr , batchStdinReader )
91
+ err := NewCommandContext (ctx , "cat-file" , "--batch" ).
92
+ SetDescription (fmt .Sprintf ("%s cat-file --batch [repo_path: %s] (%s:%d)" , GitExecutable , repoPath , filename , line )).
93
+ RunInDirFullPipeline (repoPath , batchStdoutWriter , & stderr , batchStdinReader )
82
94
if err != nil {
83
95
_ = batchStdoutWriter .CloseWithError (ConcatenateError (err , (& stderr ).String ()))
84
96
_ = batchStdinReader .CloseWithError (ConcatenateError (err , (& stderr ).String ()))
@@ -292,3 +304,10 @@ func ParseTreeLine(rd *bufio.Reader, modeBuf, fnameBuf, shaBuf []byte) (mode, fn
292
304
sha = shaBuf
293
305
return
294
306
}
307
+
308
+ var callerPrefix string
309
+
310
+ func init () {
311
+ _ , filename , _ , _ := runtime .Caller (0 )
312
+ callerPrefix = strings .TrimSuffix (filename , "modules/git/batch_reader.go" )
313
+ }
0 commit comments