Refactor git command stderr handling (#36402)

And clean up legacy fragile & incorrect logic
This commit is contained in:
wxiaoguang authored and GitHub committed 2026-01-18 15:10:33 -08:00
1 parent fafd1db19e
commit 72be55f7d3
69 files changed
+345 -627

No files matched your search

+2 -10
View File
@@ -64,20 +64,12 @@ func LogNameStatusRepo(ctx context.Context, repository, head, treepath string, p
cmd.AddDashesAndList(files...)
go func() {
stderr := strings.Builder{}
err := cmd.WithDir(repository).
WithStdout(stdoutWriter).
WithStderr(&stderr).
Run(ctx)
if err != nil {
_ = stdoutWriter.CloseWithError(gitcmd.ConcatenateError(err, (&stderr).String()))
return
}
_ = stdoutWriter.Close()
RunWithStderr(ctx)
_ = stdoutWriter.CloseWithError(err)
}()
// For simplicities sake we'll us a buffered reader to read from the cat-file --batch
bufReader := bufio.NewReaderSize(stdoutReader, 32*1024)
return bufReader, cancel