forked from NYANDEV/forgejo
Change git.cmd to RunWithContext (#18693)
Change all `cmd...Pipeline` commands to `cmd.RunWithContext`. #18553 Co-authored-by: Martin Scholz <martin.scholz@versasec.com>
This commit is contained in:
parent
393ea86ae1
commit
26718a785a
28 changed files with 530 additions and 155 deletions
|
@ -63,10 +63,12 @@ func readUnmergedLsFileLines(ctx context.Context, tmpBasePath string, outputChan
|
|||
|
||||
stderr := &strings.Builder{}
|
||||
err = git.NewCommand(ctx, "ls-files", "-u", "-z").
|
||||
RunInDirTimeoutEnvFullPipelineFunc(
|
||||
nil, -1, tmpBasePath,
|
||||
lsFilesWriter, stderr, nil,
|
||||
func(_ context.Context, _ context.CancelFunc) error {
|
||||
RunWithContext(&git.RunContext{
|
||||
Timeout: -1,
|
||||
Dir: tmpBasePath,
|
||||
Stdout: lsFilesWriter,
|
||||
Stderr: stderr,
|
||||
PipelineFunc: func(_ context.Context, _ context.CancelFunc) error {
|
||||
_ = lsFilesWriter.Close()
|
||||
defer func() {
|
||||
_ = lsFilesReader.Close()
|
||||
|
@ -102,8 +104,8 @@ func readUnmergedLsFileLines(ctx context.Context, tmpBasePath string, outputChan
|
|||
toemit.path = split[2][2 : len(split[2])-1]
|
||||
outputChan <- toemit
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
outputChan <- &lsFileLine{err: fmt.Errorf("git ls-files -u -z: %v", git.ConcatenateError(err, stderr.String()))}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue