mirror of
https://github.com/go-gitea/gitea.git
synced 2026-01-20 06:22:40 +01:00
Refactor git command stderr handling (#36402)
And clean up legacy fragile & incorrect logic
This commit is contained in:
@@ -1271,13 +1271,11 @@ func getDiffBasic(ctx context.Context, gitRepo *git.Repository, opts *DiffOption
|
||||
}()
|
||||
|
||||
go func() {
|
||||
stderr := &bytes.Buffer{}
|
||||
if err := cmdDiff.WithTimeout(time.Duration(setting.Git.Timeout.Default) * time.Second).
|
||||
WithDir(repoPath).
|
||||
WithStdout(writer).
|
||||
WithStderr(stderr).
|
||||
Run(cmdCtx); err != nil && !git.IsErrCanceledOrKilled(err) {
|
||||
log.Error("error during GetDiff(git diff dir: %s): %v, stderr: %s", repoPath, err, stderr.String())
|
||||
RunWithStderr(cmdCtx); err != nil && !git.IsErrCanceledOrKilled(err) {
|
||||
log.Error("error during GetDiff(git diff dir: %s): %v", repoPath, err)
|
||||
}
|
||||
|
||||
_ = writer.Close()
|
||||
|
||||
Reference in New Issue
Block a user