Skip to content

Commit a70ef5f

Browse files
committed
Add trace code back
1 parent d17e7ad commit a70ef5f

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

modules/git/attribute/batch.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ import (
1717

1818
// BatchChecker provides a reader for check-attribute content that can be long running
1919
type BatchChecker struct {
20-
// params
2120
attributesNum int
2221
repo *git.Repository
23-
24-
stdinWriter *os.File
25-
stdOut *nulSeparatedAttributeWriter
26-
ctx context.Context
27-
cancel context.CancelFunc
22+
stdinWriter *os.File
23+
stdOut *nulSeparatedAttributeWriter
24+
ctx context.Context
25+
cancel context.CancelFunc
26+
cmd *git.Command
2827
}
2928

3029
// NewBatchChecker creates a check attribute reader for the current repository and provided commit ID
@@ -44,6 +43,7 @@ func NewBatchChecker(repo *git.Repository, treeish string, attributes ...string)
4443
attributesNum: len(attributes),
4544
repo: repo,
4645
ctx: ctx,
46+
cmd: cmd,
4747
cancel: func() {
4848
cancel()
4949
cleanup()
@@ -113,10 +113,9 @@ func (c *BatchChecker) CheckPath(path string) (rs Attributes, err error) {
113113
}
114114
debugMsg := fmt.Sprintf("check path %q in repo %q", path, filepath.Base(c.repo.Path))
115115
debugMsg += fmt.Sprintf(", stdOut: tmp=%q, pos=%d, closed=%v", string(c.stdOut.tmp), c.stdOut.pos, stdOutClosed)
116-
// FIXME:
117-
//if c.cmd.cmd != nil {
118-
// debugMsg += fmt.Sprintf(", process state: %q", c.cmd.cmd.ProcessState.String())
119-
//}
116+
if c.cmd != nil {
117+
debugMsg += fmt.Sprintf(", process state: %q", c.cmd.ProcessState())
118+
}
120119
_ = c.Close()
121120
return fmt.Errorf("CheckPath timeout: %s", debugMsg)
122121
}

modules/git/command.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ func (c *Command) LogString() string {
8080
return strings.Join(a, " ")
8181
}
8282

83+
func (c *Command) ProcessState() string {
84+
if c.cmd == nil {
85+
return ""
86+
}
87+
return c.cmd.ProcessState.String()
88+
}
89+
8390
// NewCommand creates and returns a new Git Command based on given command and arguments.
8491
// Each argument should be safe to be trusted. User-provided arguments should be passed to AddDynamicArguments instead.
8592
func NewCommand(args ...internal.CmdArg) *Command {

0 commit comments

Comments
 (0)