diff options
author | 6543 <6543@obermui.de> | 2022-02-06 20:01:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-06 20:01:47 +0100 |
commit | 3043eb36bfcd7ddf29202b958b91942826a8182b (patch) | |
tree | f6bfcb38648f07ff8132558ff826b8b1aac003ec /integrations/git_helper_for_declarative_test.go | |
parent | 8ae5e6d7fdd577ebf0807bf33a4cdeef35d254d9 (diff) | |
download | gitea-3043eb36bfcd7ddf29202b958b91942826a8182b.tar.gz gitea-3043eb36bfcd7ddf29202b958b91942826a8182b.zip |
Delete old git.NewCommand() and use it as git.NewCommandContext() (#18552)
Diffstat (limited to 'integrations/git_helper_for_declarative_test.go')
-rw-r--r-- | integrations/git_helper_for_declarative_test.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/integrations/git_helper_for_declarative_test.go b/integrations/git_helper_for_declarative_test.go index e1b6b779e9..674fad5f18 100644 --- a/integrations/git_helper_for_declarative_test.go +++ b/integrations/git_helper_for_declarative_test.go @@ -134,7 +134,7 @@ func doGitInitTestRepository(dstPath string) func(*testing.T) { // Init repository in dstPath assert.NoError(t, git.InitRepository(git.DefaultContext, dstPath, false)) // forcibly set default branch to master - _, err := git.NewCommand("symbolic-ref", "HEAD", git.BranchPrefix+"master").RunInDir(dstPath) + _, err := git.NewCommand(git.DefaultContext, "symbolic-ref", "HEAD", git.BranchPrefix+"master").RunInDir(dstPath) assert.NoError(t, err) assert.NoError(t, os.WriteFile(filepath.Join(dstPath, "README.md"), []byte(fmt.Sprintf("# Testing Repository\n\nOriginally created in: %s", dstPath)), 0o644)) assert.NoError(t, git.AddChanges(dstPath, true)) @@ -153,28 +153,28 @@ func doGitInitTestRepository(dstPath string) func(*testing.T) { func doGitAddRemote(dstPath, remoteName string, u *url.URL) func(*testing.T) { return func(t *testing.T) { - _, err := git.NewCommand("remote", "add", remoteName, u.String()).RunInDir(dstPath) + _, err := git.NewCommand(git.DefaultContext, "remote", "add", remoteName, u.String()).RunInDir(dstPath) assert.NoError(t, err) } } func doGitPushTestRepository(dstPath string, args ...string) func(*testing.T) { return func(t *testing.T) { - _, err := git.NewCommand(append([]string{"push", "-u"}, args...)...).RunInDir(dstPath) + _, err := git.NewCommand(git.DefaultContext, append([]string{"push", "-u"}, args...)...).RunInDir(dstPath) assert.NoError(t, err) } } func doGitPushTestRepositoryFail(dstPath string, args ...string) func(*testing.T) { return func(t *testing.T) { - _, err := git.NewCommand(append([]string{"push"}, args...)...).RunInDir(dstPath) + _, err := git.NewCommand(git.DefaultContext, append([]string{"push"}, args...)...).RunInDir(dstPath) assert.Error(t, err) } } func doGitCreateBranch(dstPath, branch string) func(*testing.T) { return func(t *testing.T) { - _, err := git.NewCommand("checkout", "-b", branch).RunInDir(dstPath) + _, err := git.NewCommand(git.DefaultContext, "checkout", "-b", branch).RunInDir(dstPath) assert.NoError(t, err) } } @@ -188,7 +188,7 @@ func doGitCheckoutBranch(dstPath string, args ...string) func(*testing.T) { func doGitMerge(dstPath string, args ...string) func(*testing.T) { return func(t *testing.T) { - _, err := git.NewCommand(append([]string{"merge"}, args...)...).RunInDir(dstPath) + _, err := git.NewCommand(git.DefaultContext, append([]string{"merge"}, args...)...).RunInDir(dstPath) assert.NoError(t, err) } } |