aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2023-08-04 21:44:25 +0800
committerGitHub <noreply@github.com>2023-08-04 15:44:25 +0200
commit9451781ebea0d9945127c142136e5b6ef373141c (patch)
treea2d889014b7142d458a550ecd8ceba6a59dd86bc
parent88f6f7579cdaa557333bc86b3e45bf6458d889b6 (diff)
downloadgitea-9451781ebea0d9945127c142136e5b6ef373141c.tar.gz
gitea-9451781ebea0d9945127c142136e5b6ef373141c.zip
Make git batch operations use parent context timeout instead of default timeout (#26325) (#26330)
Backport #26325 by @wxiaoguang Fix #26064 Some git commands should use parent context, otherwise it would exit too early (by the default timeout, 10m), and the "cmd.Wait" waits till the pipes are closed. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
-rw-r--r--modules/git/batch_reader.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/git/batch_reader.go b/modules/git/batch_reader.go
index 75539c0d0a..9f65e67206 100644
--- a/modules/git/batch_reader.go
+++ b/modules/git/batch_reader.go
@@ -74,6 +74,8 @@ func CatFileBatchCheck(ctx context.Context, repoPath string) (WriteCloserError,
Stdin: batchStdinReader,
Stdout: batchStdoutWriter,
Stderr: &stderr,
+
+ UseContextTimeout: true,
})
if err != nil {
_ = batchStdoutWriter.CloseWithError(ConcatenateError(err, (&stderr).String()))
@@ -124,6 +126,8 @@ func CatFileBatch(ctx context.Context, repoPath string) (WriteCloserError, *bufi
Stdin: batchStdinReader,
Stdout: batchStdoutWriter,
Stderr: &stderr,
+
+ UseContextTimeout: true,
})
if err != nil {
_ = batchStdoutWriter.CloseWithError(ConcatenateError(err, (&stderr).String()))