Skip to content

Commit 0f8b0bd

Browse files
committed
Fix gogit build
1 parent e69169f commit 0f8b0bd

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

modules/git/gitcmd/command_race_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func TestRunWithContextNoTimeout(t *testing.T) {
1717
// 'git --version' does not block so it must be finished before the timeout triggered.
1818
cmd := NewCommand("--version")
1919
for i := 0; i < maxLoops; i++ {
20-
if err := cmd.Run(t.Context(), &RunOpts{}); err != nil {
20+
if err := cmd.Run(t.Context()); err != nil {
2121
t.Fatal(err)
2222
}
2323
}
@@ -29,7 +29,7 @@ func TestRunWithContextTimeout(t *testing.T) {
2929
// 'git hash-object --stdin' blocks on stdin so we can have the timeout triggered.
3030
cmd := NewCommand("hash-object", "--stdin")
3131
for i := 0; i < maxLoops; i++ {
32-
if err := cmd.Run(t.Context(), &RunOpts{Timeout: 1 * time.Millisecond}); err != nil {
32+
if err := cmd.WithTimeout(1 * time.Millisecond).Run(t.Context()); err != nil {
3333
if err != context.DeadlineExceeded {
3434
t.Fatalf("Testing %d/%d: %v", i, maxLoops, err)
3535
}

modules/git/repo_commit_gogit.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ func (repo *Repository) ConvertToGitID(commitID string) (ObjectID, error) {
5151
}
5252
}
5353

54-
actualCommitID, _, err := gitcmd.NewCommand("rev-parse", "--verify").AddDynamicArguments(commitID).RunStdString(repo.Ctx, &gitcmd.RunOpts{Dir: repo.Path})
54+
actualCommitID, _, err := gitcmd.NewCommand("rev-parse", "--verify").
55+
AddDynamicArguments(commitID).
56+
WithDir(repo.Path).
57+
RunStdString(repo.Ctx)
5558
actualCommitID = strings.TrimSpace(actualCommitID)
5659
if err != nil {
5760
if strings.Contains(err.Error(), "unknown revision or path") ||

modules/git/repo_tree_gogit.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ func (repo *Repository) GetTree(idStr string) (*Tree, error) {
3838
}
3939

4040
if len(idStr) != objectFormat.FullLength() {
41-
res, _, err := gitcmd.NewCommand("rev-parse", "--verify").AddDynamicArguments(idStr).RunStdString(repo.Ctx, &gitcmd.RunOpts{Dir: repo.Path})
41+
res, _, err := gitcmd.NewCommand("rev-parse", "--verify").
42+
AddDynamicArguments(idStr).
43+
WithDir(repo.Path).
44+
RunStdString(repo.Ctx)
4245
if err != nil {
4346
return nil, err
4447
}

0 commit comments

Comments
 (0)