aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-08-04 20:50:41 +0800
committerGitHub <noreply@github.com>2023-08-04 14:50:41 +0200
commit2de0752be7aaab65fe670518d00175be479ea054 (patch)
tree7d13521d8c72afa016c7d8c15e7141ef2cc9ce2e
parent68c652d8f3df9daa99ce41e0782b44347555a3a5 (diff)
downloadgitea-2de0752be7aaab65fe670518d00175be479ea054.tar.gz
gitea-2de0752be7aaab65fe670518d00175be479ea054.zip
Make git batch operations use parent context timeout instead of default timeout (#26325)
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.
-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 891e8a2384..7a44e6295c 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()))