Skip to content

Commit b96c88b

Browse files
wxiaoguangGiteaBot
authored andcommitted
Make git batch operations use parent context timeout instead of default timeout (go-gitea#26325)
Fix go-gitea#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.
1 parent 88f6f75 commit b96c88b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

modules/git/batch_reader.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ func CatFileBatchCheck(ctx context.Context, repoPath string) (WriteCloserError,
7474
Stdin: batchStdinReader,
7575
Stdout: batchStdoutWriter,
7676
Stderr: &stderr,
77+
78+
UseContextTimeout: true,
7779
})
7880
if err != nil {
7981
_ = batchStdoutWriter.CloseWithError(ConcatenateError(err, (&stderr).String()))
@@ -124,6 +126,8 @@ func CatFileBatch(ctx context.Context, repoPath string) (WriteCloserError, *bufi
124126
Stdin: batchStdinReader,
125127
Stdout: batchStdoutWriter,
126128
Stderr: &stderr,
129+
130+
UseContextTimeout: true,
127131
})
128132
if err != nil {
129133
_ = batchStdoutWriter.CloseWithError(ConcatenateError(err, (&stderr).String()))

0 commit comments

Comments
 (0)