Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-07-19 09:56:19 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-07-20 09:48:15 +0300
commit819774300da6567726c3d9022fe0c20a12cb795e (patch)
treece9d4f17adb27b20b1b57d38cc219b39a8aef30a /cmd/gitaly-git2go
parent7939e4787efda5bc1450e029f641dffd8c197ef9 (diff)
git2go: Implement cherry-pick on top of the executor
We're about to extend dependencies required to run gitaly-git2go subcommands, which will make calling them tedious. This commit thus refactors the cherry-pick subcommand to be implemented on top of the `Executor` structure, which encapsulates all required dependencies and thus avoids the additional complexity.
Diffstat (limited to 'cmd/gitaly-git2go')
-rw-r--r--cmd/gitaly-git2go/cherry_pick_test.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/cmd/gitaly-git2go/cherry_pick_test.go b/cmd/gitaly-git2go/cherry_pick_test.go
index 7b7279c9b..59ec48468 100644
--- a/cmd/gitaly-git2go/cherry_pick_test.go
+++ b/cmd/gitaly-git2go/cherry_pick_test.go
@@ -19,6 +19,7 @@ import (
func TestCherryPick_validation(t *testing.T) {
cfg, _, repoPath := testcfg.BuildWithRepo(t)
testhelper.ConfigureGitalyGit2GoBin(t, cfg)
+ executor := git2go.NewExecutor(cfg)
testcases := []struct {
desc string
@@ -70,7 +71,7 @@ func TestCherryPick_validation(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- _, err := tc.request.Run(ctx, cfg)
+ _, err := executor.CherryPick(ctx, tc.request)
require.EqualError(t, err, tc.expectedErr)
})
}
@@ -146,6 +147,7 @@ func TestCherryPick(t *testing.T) {
for _, tc := range testcases {
cfg, _, repoPath := testcfg.BuildWithRepo(t)
testhelper.ConfigureGitalyGit2GoBin(t, cfg)
+ executor := git2go.NewExecutor(cfg)
base := cmdtesthelper.BuildCommit(t, repoPath, []*git.Oid{nil}, tc.base)
@@ -167,7 +169,7 @@ func TestCherryPick(t *testing.T) {
When: time.Date(2021, 1, 17, 14, 45, 51, 0, time.FixedZone("", +2*60*60)),
}
- response, err := git2go.CherryPickCommand{
+ response, err := executor.CherryPick(ctx, git2go.CherryPickCommand{
Repository: repoPath,
CommitterName: committer.Name,
CommitterMail: committer.Email,
@@ -175,7 +177,7 @@ func TestCherryPick(t *testing.T) {
Message: "Foo",
Ours: ours,
Commit: commit,
- }.Run(ctx, cfg)
+ })
if tc.expectedErrMsg != "" {
require.EqualError(t, err, tc.expectedErrMsg)