summaryrefslogtreecommitdiffstats
path: root/modules/git/pipeline/revlist.go
diff options
context:
space:
mode:
authorMartin Scholz <martin.scholz83@outlook.com>2022-02-11 13:47:22 +0100
committerGitHub <noreply@github.com>2022-02-11 13:47:22 +0100
commit26718a785ac49f17eab51ad0f5324d036b810f73 (patch)
tree9c8371e01460dacf8e65c88b3526e2123525c717 /modules/git/pipeline/revlist.go
parent393ea86ae192325e45d7fac0fc6a277da8fb0fca (diff)
downloadgitea-26718a785ac49f17eab51ad0f5324d036b810f73.tar.gz
gitea-26718a785ac49f17eab51ad0f5324d036b810f73.zip
Change git.cmd to RunWithContext (#18693)
Change all `cmd...Pipeline` commands to `cmd.RunWithContext`. #18553 Co-authored-by: Martin Scholz <martin.scholz@versasec.com>
Diffstat (limited to 'modules/git/pipeline/revlist.go')
-rw-r--r--modules/git/pipeline/revlist.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/modules/git/pipeline/revlist.go b/modules/git/pipeline/revlist.go
index 75dc676f36..a1f8f079f9 100644
--- a/modules/git/pipeline/revlist.go
+++ b/modules/git/pipeline/revlist.go
@@ -25,7 +25,12 @@ func RevListAllObjects(ctx context.Context, revListWriter *io.PipeWriter, wg *sy
stderr := new(bytes.Buffer)
var errbuf strings.Builder
cmd := git.NewCommand(ctx, "rev-list", "--objects", "--all")
- if err := cmd.RunInDirPipeline(basePath, revListWriter, stderr); err != nil {
+ if err := cmd.RunWithContext(&git.RunContext{
+ Timeout: -1,
+ Dir: basePath,
+ Stdout: revListWriter,
+ Stderr: stderr,
+ }); err != nil {
log.Error("git rev-list --objects --all [%s]: %v - %s", basePath, err, errbuf.String())
err = fmt.Errorf("git rev-list --objects --all [%s]: %v - %s", basePath, err, errbuf.String())
_ = revListWriter.CloseWithError(err)
@@ -40,7 +45,12 @@ func RevListObjects(ctx context.Context, revListWriter *io.PipeWriter, wg *sync.
stderr := new(bytes.Buffer)
var errbuf strings.Builder
cmd := git.NewCommand(ctx, "rev-list", "--objects", headSHA, "--not", baseSHA)
- if err := cmd.RunInDirPipeline(tmpBasePath, revListWriter, stderr); err != nil {
+ if err := cmd.RunWithContext(&git.RunContext{
+ Timeout: -1,
+ Dir: tmpBasePath,
+ Stdout: revListWriter,
+ Stderr: stderr,
+ }); err != nil {
log.Error("git rev-list [%s]: %v - %s", tmpBasePath, err, errbuf.String())
errChan <- fmt.Errorf("git rev-list [%s]: %v - %s", tmpBasePath, err, errbuf.String())
}