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
|
@ -274,7 +274,13 @@ func TestCantMergeUnrelated(t *testing.T) {
|
|||
|
||||
stdin := bytes.NewBufferString("Unrelated File")
|
||||
var stdout strings.Builder
|
||||
err = git.NewCommand(git.DefaultContext, "hash-object", "-w", "--stdin").RunInDirFullPipeline(path, &stdout, nil, stdin)
|
||||
err = git.NewCommand(git.DefaultContext, "hash-object", "-w", "--stdin").RunWithContext(&git.RunContext{
|
||||
Timeout: -1,
|
||||
Dir: path,
|
||||
Stdin: stdin,
|
||||
Stdout: &stdout,
|
||||
})
|
||||
|
||||
assert.NoError(t, err)
|
||||
sha := strings.TrimSpace(stdout.String())
|
||||
|
||||
|
@ -301,7 +307,14 @@ func TestCantMergeUnrelated(t *testing.T) {
|
|||
_, _ = messageBytes.WriteString("\n")
|
||||
|
||||
stdout.Reset()
|
||||
err = git.NewCommand(git.DefaultContext, "commit-tree", treeSha).RunInDirTimeoutEnvFullPipeline(env, -1, path, &stdout, nil, messageBytes)
|
||||
err = git.NewCommand(git.DefaultContext, "commit-tree", treeSha).
|
||||
RunWithContext(&git.RunContext{
|
||||
Env: env,
|
||||
Timeout: -1,
|
||||
Dir: path,
|
||||
Stdin: messageBytes,
|
||||
Stdout: &stdout,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
commitSha := strings.TrimSpace(stdout.String())
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue