diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-08-13 20:49:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-13 20:49:30 +0800 |
commit | 82ea557dd37312af02b991069e2debb71721882b (patch) | |
tree | 70de5e1099d2cd43ef2861c00bced7dc67e45a7c /services/gitdiff | |
parent | ca74b074ea84dea1c37f7bd04b299de602e57e8c (diff) | |
download | gitea-82ea557dd37312af02b991069e2debb71721882b.tar.gz gitea-82ea557dd37312af02b991069e2debb71721882b.zip |
Fix stderr usages (#26477)
Diffstat (limited to 'services/gitdiff')
-rw-r--r-- | services/gitdiff/gitdiff.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/services/gitdiff/gitdiff.go b/services/gitdiff/gitdiff.go index 4cb2b1303d..4cc093e65d 100644 --- a/services/gitdiff/gitdiff.go +++ b/services/gitdiff/gitdiff.go @@ -13,7 +13,6 @@ import ( "html/template" "io" "net/url" - "os" "sort" "strings" "time" @@ -1152,14 +1151,15 @@ func GetDiff(gitRepo *git.Repository, opts *DiffOptions, files ...string) (*Diff }() go func() { + stderr := &bytes.Buffer{} cmdDiff.SetDescription(fmt.Sprintf("GetDiffRange [repo_path: %s]", repoPath)) if err := cmdDiff.Run(&git.RunOpts{ Timeout: time.Duration(setting.Git.Timeout.Default) * time.Second, Dir: repoPath, - Stderr: os.Stderr, Stdout: writer, + Stderr: stderr, }); err != nil { - log.Error("error during RunWithContext: %w", err) + log.Error("error during GetDiff(git diff dir: %s): %v, stderr: %s", repoPath, err, stderr.String()) } _ = writer.Close() |