Skip to content

Commit bce27d0

Browse files
GiteaBotearl-warrenGusted
authored
Concatenate error in checkIfPRContentChanged (go-gitea#28731) (go-gitea#28737)
Backport go-gitea#28731 by @earl-warren - If there's a error with the Git command in `checkIfPRContentChanged` the stderr wasn't concatendated to the error, which results in still not knowing why an error happend. - Adds concatenation for stderr to the returned error. - Ref: https://codeberg.org/forgejo/forgejo/issues/2077 Co-authored-by: Earl Warren <[email protected]> Co-authored-by: Gusted <[email protected]>
1 parent 12f418a commit bce27d0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

services/pull/pull.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package pull
55

66
import (
7+
"bytes"
78
"context"
89
"fmt"
910
"io"
@@ -423,9 +424,11 @@ func checkIfPRContentChanged(ctx context.Context, pr *issues_model.PullRequest,
423424
return false, fmt.Errorf("unable to open pipe for to run diff: %w", err)
424425
}
425426

427+
stderr := new(bytes.Buffer)
426428
if err := cmd.Run(&git.RunOpts{
427429
Dir: prCtx.tmpBasePath,
428430
Stdout: stdoutWriter,
431+
Stderr: stderr,
429432
PipelineFunc: func(ctx context.Context, cancel context.CancelFunc) error {
430433
_ = stdoutWriter.Close()
431434
defer func() {
@@ -437,6 +440,7 @@ func checkIfPRContentChanged(ctx context.Context, pr *issues_model.PullRequest,
437440
if err == util.ErrNotEmpty {
438441
return true, nil
439442
}
443+
err = git.ConcatenateError(err, stderr.String())
440444

441445
log.Error("Unable to run diff on %s %s %s in tempRepo for PR[%d]%s/%s...%s/%s: Error: %v",
442446
newCommitID, oldCommitID, base,

0 commit comments

Comments
 (0)