forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete old git.NewCommand() and use it as git.NewCommandContext() (go…
- Loading branch information
Showing
74 changed files
with
258 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, "[email protected]", "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 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.