aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEarl Warren <109468362+earl-warren@users.noreply.github.com>2024-01-09 03:32:14 +0100
committerGitHub <noreply@github.com>2024-01-09 10:32:14 +0800
commitaa4d78431f1acaff1aca8ec1c2b2dd36834d68dd (patch)
treecb1fda63f95db7ee86173fac51041904483b9615
parentf4ea8d9a6caa3118ded80b15e11b2e9a09d1a270 (diff)
downloadgitea-aa4d78431f1acaff1aca8ec1c2b2dd36834d68dd.tar.gz
gitea-aa4d78431f1acaff1aca8ec1c2b2dd36834d68dd.zip
Concatenate error in `checkIfPRContentChanged` (#28731)
- 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: Gusted <postmaster@gusted.xyz>
-rw-r--r--services/pull/pull.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/services/pull/pull.go b/services/pull/pull.go
index 6094a4ed31..d1630f3792 100644
--- a/services/pull/pull.go
+++ b/services/pull/pull.go
@@ -4,6 +4,7 @@
package pull
import (
+ "bytes"
"context"
"fmt"
"io"
@@ -422,9 +423,11 @@ func checkIfPRContentChanged(ctx context.Context, pr *issues_model.PullRequest,
return false, fmt.Errorf("unable to open pipe for to run diff: %w", err)
}
+ stderr := new(bytes.Buffer)
if err := cmd.Run(&git.RunOpts{
Dir: prCtx.tmpBasePath,
Stdout: stdoutWriter,
+ Stderr: stderr,
PipelineFunc: func(ctx context.Context, cancel context.CancelFunc) error {
_ = stdoutWriter.Close()
defer func() {
@@ -436,6 +439,7 @@ func checkIfPRContentChanged(ctx context.Context, pr *issues_model.PullRequest,
if err == util.ErrNotEmpty {
return true, nil
}
+ err = git.ConcatenateError(err, stderr.String())
log.Error("Unable to run diff on %s %s %s in tempRepo for PR[%d]%s/%s...%s/%s: Error: %v",
newCommitID, oldCommitID, base,