aboutsummaryrefslogtreecommitdiffstats
path: root/integrations/git_test.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2022-02-06 20:01:47 +0100
committerGitHub <noreply@github.com>2022-02-06 20:01:47 +0100
commit3043eb36bfcd7ddf29202b958b91942826a8182b (patch)
treef6bfcb38648f07ff8132558ff826b8b1aac003ec /integrations/git_test.go
parent8ae5e6d7fdd577ebf0807bf33a4cdeef35d254d9 (diff)
downloadgitea-3043eb36bfcd7ddf29202b958b91942826a8182b.tar.gz
gitea-3043eb36bfcd7ddf29202b958b91942826a8182b.zip
Delete old git.NewCommand() and use it as git.NewCommandContext() (#18552)
Diffstat (limited to 'integrations/git_test.go')
-rw-r--r--integrations/git_test.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/integrations/git_test.go b/integrations/git_test.go
index e5a85eb756..e1df8ac546 100644
--- a/integrations/git_test.go
+++ b/integrations/git_test.go
@@ -160,9 +160,9 @@ func lfsCommitAndPushTest(t *testing.T, dstPath string) (littleLFS, bigLFS strin
return
}
prefix := "lfs-data-file-"
- _, err := git.NewCommand("lfs").AddArguments("install").RunInDir(dstPath)
+ _, err := git.NewCommand(git.DefaultContext, "lfs").AddArguments("install").RunInDir(dstPath)
assert.NoError(t, err)
- _, err = git.NewCommand("lfs").AddArguments("track", prefix+"*").RunInDir(dstPath)
+ _, err = git.NewCommand(git.DefaultContext, "lfs").AddArguments("track", prefix+"*").RunInDir(dstPath)
assert.NoError(t, err)
err = git.AddChanges(dstPath, false, ".gitattributes")
assert.NoError(t, err)
@@ -292,20 +292,20 @@ func lockTest(t *testing.T, repoPath string) {
}
func lockFileTest(t *testing.T, filename, repoPath string) {
- _, err := git.NewCommand("lfs").AddArguments("locks").RunInDir(repoPath)
+ _, err := git.NewCommand(git.DefaultContext, "lfs").AddArguments("locks").RunInDir(repoPath)
assert.NoError(t, err)
- _, err = git.NewCommand("lfs").AddArguments("lock", filename).RunInDir(repoPath)
+ _, err = git.NewCommand(git.DefaultContext, "lfs").AddArguments("lock", filename).RunInDir(repoPath)
assert.NoError(t, err)
- _, err = git.NewCommand("lfs").AddArguments("locks").RunInDir(repoPath)
+ _, err = git.NewCommand(git.DefaultContext, "lfs").AddArguments("locks").RunInDir(repoPath)
assert.NoError(t, err)
- _, err = git.NewCommand("lfs").AddArguments("unlock", filename).RunInDir(repoPath)
+ _, err = git.NewCommand(git.DefaultContext, "lfs").AddArguments("unlock", filename).RunInDir(repoPath)
assert.NoError(t, err)
}
func doCommitAndPush(t *testing.T, size int, repoPath, prefix string) string {
name, err := generateCommitWithNewData(size, repoPath, "user2@example.com", "User Two", prefix)
assert.NoError(t, err)
- _, err = git.NewCommand("push", "origin", "master").RunInDir(repoPath) // Push
+ _, err = git.NewCommand(git.DefaultContext, "push", "origin", "master").RunInDir(repoPath) // Push
assert.NoError(t, err)
return name
}
@@ -671,7 +671,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB
})
t.Run("Push", func(t *testing.T) {
- _, err := git.NewCommand("push", "origin", "HEAD:refs/for/master", "-o", "topic="+headBranch).RunInDir(dstPath)
+ _, err := git.NewCommand(git.DefaultContext, "push", "origin", "HEAD:refs/for/master", "-o", "topic="+headBranch).RunInDir(dstPath)
if !assert.NoError(t, err) {
return
}
@@ -692,7 +692,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB
assert.Contains(t, "Testing commit 1", prMsg.Body)
assert.Equal(t, commit, prMsg.Head.Sha)
- _, err = git.NewCommand("push", "origin", "HEAD:refs/for/master/test/"+headBranch).RunInDir(dstPath)
+ _, err = git.NewCommand(git.DefaultContext, "push", "origin", "HEAD:refs/for/master/test/"+headBranch).RunInDir(dstPath)
if !assert.NoError(t, err) {
return
}
@@ -745,7 +745,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB
})
t.Run("Push2", func(t *testing.T) {
- _, err := git.NewCommand("push", "origin", "HEAD:refs/for/master", "-o", "topic="+headBranch).RunInDir(dstPath)
+ _, err := git.NewCommand(git.DefaultContext, "push", "origin", "HEAD:refs/for/master", "-o", "topic="+headBranch).RunInDir(dstPath)
if !assert.NoError(t, err) {
return
}
@@ -757,7 +757,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB
assert.Equal(t, false, prMsg.HasMerged)
assert.Equal(t, commit, prMsg.Head.Sha)
- _, err = git.NewCommand("push", "origin", "HEAD:refs/for/master/test/"+headBranch).RunInDir(dstPath)
+ _, err = git.NewCommand(git.DefaultContext, "push", "origin", "HEAD:refs/for/master/test/"+headBranch).RunInDir(dstPath)
if !assert.NoError(t, err) {
return
}