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>2022-01-17 17:02:31 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-01-24 13:46:24 +0300
commit4981b4d7ac872343148b4bad85adfc3afeec1e16 (patch)
tree18bcf1229f7791fc937e0224ac81507d6e2459f3 /internal/gitaly
parentd790dce896fba33bdde0384cd05eed81ff17a5b3 (diff)
services: Inject Git2go executor
Inject the Git2go executor into services requiring it so that they don't have to create ad-hoc instances of it anymore. While at it, convert the executor to a pointer receiver such that there only is a single global instance of it.
Diffstat (limited to 'internal/gitaly')
-rw-r--r--internal/gitaly/maintenance/optimize_test.go3
-rw-r--r--internal/gitaly/service/conflicts/list_conflict_files.go2
-rw-r--r--internal/gitaly/service/conflicts/resolve_conflicts.go2
-rw-r--r--internal/gitaly/service/conflicts/server.go33
-rw-r--r--internal/gitaly/service/conflicts/testhelper_test.go2
-rw-r--r--internal/gitaly/service/dependencies.go7
-rw-r--r--internal/gitaly/service/operations/branches_test.go2
-rw-r--r--internal/gitaly/service/operations/cherry_pick.go2
-rw-r--r--internal/gitaly/service/operations/commit_files.go2
-rw-r--r--internal/gitaly/service/operations/merge.go4
-rw-r--r--internal/gitaly/service/operations/rebase.go2
-rw-r--r--internal/gitaly/service/operations/revert.go2
-rw-r--r--internal/gitaly/service/operations/server.go37
-rw-r--r--internal/gitaly/service/operations/squash.go2
-rw-r--r--internal/gitaly/service/operations/submodules.go2
-rw-r--r--internal/gitaly/service/operations/tags_test.go1
-rw-r--r--internal/gitaly/service/operations/testhelper_test.go2
-rw-r--r--internal/gitaly/service/repository/apply_gitattributes_test.go1
-rw-r--r--internal/gitaly/service/repository/create_fork_test.go5
-rw-r--r--internal/gitaly/service/repository/fetch_bundle_test.go1
-rw-r--r--internal/gitaly/service/repository/fetch_remote_test.go1
-rw-r--r--internal/gitaly/service/repository/search_files_test.go15
-rw-r--r--internal/gitaly/service/repository/server.go41
-rw-r--r--internal/gitaly/service/repository/testhelper_test.go1
-rw-r--r--internal/gitaly/service/setup/register.go3
25 files changed, 108 insertions, 67 deletions
diff --git a/internal/gitaly/maintenance/optimize_test.go b/internal/gitaly/maintenance/optimize_test.go
index 06f64f595..beb753b28 100644
--- a/internal/gitaly/maintenance/optimize_test.go
+++ b/internal/gitaly/maintenance/optimize_test.go
@@ -13,6 +13,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/backchannel"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/catfile"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/git2go"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/service/repository"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/transaction"
@@ -35,6 +36,7 @@ func (mo *mockOptimizer) OptimizeRepository(ctx context.Context, req *gitalypb.O
gitCmdFactory := gittest.NewCommandFactory(mo.t, mo.cfg)
catfileCache := catfile.NewCache(mo.cfg)
mo.t.Cleanup(catfileCache.Stop)
+ git2goExecutor := git2go.NewExecutor(mo.cfg, gitCmdFactory, l)
connsPool := client.NewPool()
mo.t.Cleanup(func() { testhelper.MustClose(mo.t, connsPool) })
@@ -45,6 +47,7 @@ func (mo *mockOptimizer) OptimizeRepository(ctx context.Context, req *gitalypb.O
gitCmdFactory,
catfileCache,
connsPool,
+ git2goExecutor,
).OptimizeRepository(ctx, req)
assert.NoError(mo.t, err)
return resp, err
diff --git a/internal/gitaly/service/conflicts/list_conflict_files.go b/internal/gitaly/service/conflicts/list_conflict_files.go
index 2fe1447dc..c81fd7962 100644
--- a/internal/gitaly/service/conflicts/list_conflict_files.go
+++ b/internal/gitaly/service/conflicts/list_conflict_files.go
@@ -38,7 +38,7 @@ func (s *server) ListConflictFiles(request *gitalypb.ListConflictFilesRequest, s
return err
}
- conflicts, err := s.git2go.Conflicts(ctx, repo, git2go.ConflictsCommand{
+ conflicts, err := s.git2goExecutor.Conflicts(ctx, repo, git2go.ConflictsCommand{
Repository: repoPath,
Ours: ours.String(),
Theirs: theirs.String(),
diff --git a/internal/gitaly/service/conflicts/resolve_conflicts.go b/internal/gitaly/service/conflicts/resolve_conflicts.go
index ecc6ae983..7f5d01604 100644
--- a/internal/gitaly/service/conflicts/resolve_conflicts.go
+++ b/internal/gitaly/service/conflicts/resolve_conflicts.go
@@ -173,7 +173,7 @@ func (s *server) resolveConflicts(header *gitalypb.ResolveConflictsRequestHeader
return errors.New("Rugged::InvalidError: unable to parse OID - contains invalid characters")
}
- result, err := s.git2go.Resolve(ctx, quarantineRepo, git2go.ResolveCommand{
+ result, err := s.git2goExecutor.Resolve(ctx, quarantineRepo, git2go.ResolveCommand{
MergeCommand: git2go.MergeCommand{
Repository: repoPath,
AuthorName: string(header.User.Name),
diff --git a/internal/gitaly/service/conflicts/server.go b/internal/gitaly/service/conflicts/server.go
index 2412adb90..71343731c 100644
--- a/internal/gitaly/service/conflicts/server.go
+++ b/internal/gitaly/service/conflicts/server.go
@@ -16,14 +16,14 @@ import (
type server struct {
gitalypb.UnimplementedConflictsServiceServer
- cfg config.Cfg
- locator storage.Locator
- gitCmdFactory git.CommandFactory
- catfileCache catfile.Cache
- pool *client.Pool
- hookManager hook.Manager
- updater *updateref.UpdaterWithHooks
- git2go git2go.Executor
+ cfg config.Cfg
+ locator storage.Locator
+ gitCmdFactory git.CommandFactory
+ catfileCache catfile.Cache
+ pool *client.Pool
+ hookManager hook.Manager
+ updater *updateref.UpdaterWithHooks
+ git2goExecutor *git2go.Executor
}
// NewServer creates a new instance of a grpc ConflictsServer
@@ -34,16 +34,17 @@ func NewServer(
gitCmdFactory git.CommandFactory,
catfileCache catfile.Cache,
connsPool *client.Pool,
+ git2goExecutor *git2go.Executor,
) gitalypb.ConflictsServiceServer {
return &server{
- cfg: cfg,
- hookManager: hookManager,
- locator: locator,
- gitCmdFactory: gitCmdFactory,
- catfileCache: catfileCache,
- pool: connsPool,
- updater: updateref.NewUpdaterWithHooks(cfg, locator, hookManager, gitCmdFactory, catfileCache),
- git2go: git2go.NewExecutor(cfg, gitCmdFactory, locator),
+ cfg: cfg,
+ hookManager: hookManager,
+ locator: locator,
+ gitCmdFactory: gitCmdFactory,
+ catfileCache: catfileCache,
+ pool: connsPool,
+ updater: updateref.NewUpdaterWithHooks(cfg, locator, hookManager, gitCmdFactory, catfileCache),
+ git2goExecutor: git2goExecutor,
}
}
diff --git a/internal/gitaly/service/conflicts/testhelper_test.go b/internal/gitaly/service/conflicts/testhelper_test.go
index 5a4b9e885..96d9a80f4 100644
--- a/internal/gitaly/service/conflicts/testhelper_test.go
+++ b/internal/gitaly/service/conflicts/testhelper_test.go
@@ -61,6 +61,7 @@ func runConflictsServer(t testing.TB, cfg config.Cfg, hookManager hook.Manager)
deps.GetGitCmdFactory(),
deps.GetCatfileCache(),
deps.GetConnsPool(),
+ deps.GetGit2goExecutor(),
))
gitalypb.RegisterRepositoryServiceServer(srv, repository.NewServer(
deps.GetCfg(),
@@ -70,6 +71,7 @@ func runConflictsServer(t testing.TB, cfg config.Cfg, hookManager hook.Manager)
deps.GetGitCmdFactory(),
deps.GetCatfileCache(),
deps.GetConnsPool(),
+ deps.GetGit2goExecutor(),
))
gitalypb.RegisterSSHServiceServer(srv, ssh.NewServer(
deps.GetCfg(),
diff --git a/internal/gitaly/service/dependencies.go b/internal/gitaly/service/dependencies.go
index 3228f5e4b..d724deed5 100644
--- a/internal/gitaly/service/dependencies.go
+++ b/internal/gitaly/service/dependencies.go
@@ -6,6 +6,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/cache"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/catfile"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/git2go"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/config"
gitalyhook "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/hook"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/linguist"
@@ -33,6 +34,7 @@ type Dependencies struct {
DiskCache cache.Cache
PackObjectsCache streamcache.Cache
LimitHandler *limithandler.LimiterMiddleware
+ Git2goExecutor *git2go.Executor
}
// GetCfg returns service configuration.
@@ -104,3 +106,8 @@ func (dc *Dependencies) GetPackObjectsCache() streamcache.Cache {
func (dc *Dependencies) GetLimitHandler() *limithandler.LimiterMiddleware {
return dc.LimitHandler
}
+
+// GetGit2goExecutor returns the git2go executor.
+func (dc *Dependencies) GetGit2goExecutor() *git2go.Executor {
+ return dc.Git2goExecutor
+}
diff --git a/internal/gitaly/service/operations/branches_test.go b/internal/gitaly/service/operations/branches_test.go
index 8604987c5..ef50e7a6a 100644
--- a/internal/gitaly/service/operations/branches_test.go
+++ b/internal/gitaly/service/operations/branches_test.go
@@ -132,6 +132,7 @@ func TestUserCreateBranchWithTransaction(t *testing.T) {
deps.GetTxManager(),
deps.GetLocator(),
deps.GetConnsPool(),
+ deps.GetGit2goExecutor(),
deps.GetGitCmdFactory(),
deps.GetCatfileCache(),
))
@@ -494,6 +495,7 @@ func TestUserDeleteBranch_transaction(t *testing.T) {
deps.GetTxManager(),
deps.GetLocator(),
deps.GetConnsPool(),
+ deps.GetGit2goExecutor(),
deps.GetGitCmdFactory(),
deps.GetCatfileCache(),
))
diff --git a/internal/gitaly/service/operations/cherry_pick.go b/internal/gitaly/service/operations/cherry_pick.go
index 6c8f450bc..801ee93c1 100644
--- a/internal/gitaly/service/operations/cherry_pick.go
+++ b/internal/gitaly/service/operations/cherry_pick.go
@@ -51,7 +51,7 @@ func (s *Server) UserCherryPick(ctx context.Context, req *gitalypb.UserCherryPic
committerDate = req.Timestamp.AsTime()
}
- newrev, err := s.git2go.CherryPick(ctx, quarantineRepo, git2go.CherryPickCommand{
+ newrev, err := s.git2goExecutor.CherryPick(ctx, quarantineRepo, git2go.CherryPickCommand{
Repository: repoPath,
CommitterName: string(req.User.Name),
CommitterMail: string(req.User.Email),
diff --git a/internal/gitaly/service/operations/commit_files.go b/internal/gitaly/service/operations/commit_files.go
index 573cb122b..46ac68d31 100644
--- a/internal/gitaly/service/operations/commit_files.go
+++ b/internal/gitaly/service/operations/commit_files.go
@@ -291,7 +291,7 @@ func (s *Server) userCommitFiles(ctx context.Context, header *gitalypb.UserCommi
author = git2go.NewSignature(string(header.CommitAuthorName), string(header.CommitAuthorEmail), now)
}
- commitID, err := s.git2go.Commit(ctx, quarantineRepo, git2go.CommitParams{
+ commitID, err := s.git2goExecutor.Commit(ctx, quarantineRepo, git2go.CommitParams{
Repository: repoPath,
Author: author,
Committer: committer,
diff --git a/internal/gitaly/service/operations/merge.go b/internal/gitaly/service/operations/merge.go
index aec131db9..9785ce72f 100644
--- a/internal/gitaly/service/operations/merge.go
+++ b/internal/gitaly/service/operations/merge.go
@@ -72,7 +72,7 @@ func (s *Server) UserMergeBranch(stream gitalypb.OperationService_UserMergeBranc
return helper.ErrInvalidArgument(err)
}
- merge, err := s.git2go.Merge(ctx, quarantineRepo, git2go.MergeCommand{
+ merge, err := s.git2goExecutor.Merge(ctx, quarantineRepo, git2go.MergeCommand{
Repository: repoPath,
AuthorName: string(firstRequest.User.Name),
AuthorMail: string(firstRequest.User.Email),
@@ -358,7 +358,7 @@ func (s *Server) UserMergeToRef(ctx context.Context, request *gitalypb.UserMerge
}
// Now, we create the merge commit...
- merge, err := s.git2go.Merge(ctx, repo, git2go.MergeCommand{
+ merge, err := s.git2goExecutor.Merge(ctx, repo, git2go.MergeCommand{
Repository: repoPath,
AuthorName: string(request.User.Name),
AuthorMail: string(request.User.Email),
diff --git a/internal/gitaly/service/operations/rebase.go b/internal/gitaly/service/operations/rebase.go
index e92119135..66d3ac360 100644
--- a/internal/gitaly/service/operations/rebase.go
+++ b/internal/gitaly/service/operations/rebase.go
@@ -59,7 +59,7 @@ func (s *Server) UserRebaseConfirmable(stream gitalypb.OperationService_UserReba
committer.When = header.Timestamp.AsTime()
}
- newrev, err := s.git2go.Rebase(ctx, quarantineRepo, git2go.RebaseCommand{
+ newrev, err := s.git2goExecutor.Rebase(ctx, quarantineRepo, git2go.RebaseCommand{
Repository: repoPath,
Committer: committer,
BranchName: string(header.Branch),
diff --git a/internal/gitaly/service/operations/revert.go b/internal/gitaly/service/operations/revert.go
index 305eccc7e..9b57b63b2 100644
--- a/internal/gitaly/service/operations/revert.go
+++ b/internal/gitaly/service/operations/revert.go
@@ -50,7 +50,7 @@ func (s *Server) UserRevert(ctx context.Context, req *gitalypb.UserRevertRequest
return nil, helper.ErrInvalidArgument(err)
}
- newrev, err := s.git2go.Revert(ctx, quarantineRepo, git2go.RevertCommand{
+ newrev, err := s.git2goExecutor.Revert(ctx, quarantineRepo, git2go.RevertCommand{
Repository: repoPath,
AuthorName: string(req.User.Name),
AuthorMail: string(req.User.Email),
diff --git a/internal/gitaly/service/operations/server.go b/internal/gitaly/service/operations/server.go
index 0d8483251..e83359ed7 100644
--- a/internal/gitaly/service/operations/server.go
+++ b/internal/gitaly/service/operations/server.go
@@ -22,15 +22,15 @@ import (
//nolint: revive,stylecheck // This is unintentionally missing documentation.
type Server struct {
gitalypb.UnimplementedOperationServiceServer
- cfg config.Cfg
- hookManager hook.Manager
- txManager transaction.Manager
- locator storage.Locator
- conns *client.Pool
- git2go git2go.Executor
- gitCmdFactory git.CommandFactory
- catfileCache catfile.Cache
- updater *updateref.UpdaterWithHooks
+ cfg config.Cfg
+ hookManager hook.Manager
+ txManager transaction.Manager
+ locator storage.Locator
+ conns *client.Pool
+ git2goExecutor *git2go.Executor
+ gitCmdFactory git.CommandFactory
+ catfileCache catfile.Cache
+ updater *updateref.UpdaterWithHooks
// enableUserMergeBranchStructuredErrors enables the use of structured errors in
// UserMergeBranch. This flag only exists for testing purposes.
@@ -44,19 +44,20 @@ func NewServer(
txManager transaction.Manager,
locator storage.Locator,
conns *client.Pool,
+ git2goExecutor *git2go.Executor,
gitCmdFactory git.CommandFactory,
catfileCache catfile.Cache,
) *Server {
return &Server{
- cfg: cfg,
- hookManager: hookManager,
- txManager: txManager,
- locator: locator,
- conns: conns,
- git2go: git2go.NewExecutor(cfg, gitCmdFactory, locator),
- gitCmdFactory: gitCmdFactory,
- catfileCache: catfileCache,
- updater: updateref.NewUpdaterWithHooks(cfg, locator, hookManager, gitCmdFactory, catfileCache),
+ cfg: cfg,
+ hookManager: hookManager,
+ txManager: txManager,
+ locator: locator,
+ conns: conns,
+ git2goExecutor: git2goExecutor,
+ gitCmdFactory: gitCmdFactory,
+ catfileCache: catfileCache,
+ updater: updateref.NewUpdaterWithHooks(cfg, locator, hookManager, gitCmdFactory, catfileCache),
}
}
diff --git a/internal/gitaly/service/operations/squash.go b/internal/gitaly/service/operations/squash.go
index 65ee84f2f..7b070848e 100644
--- a/internal/gitaly/service/operations/squash.go
+++ b/internal/gitaly/service/operations/squash.go
@@ -135,7 +135,7 @@ func (s *Server) userSquash(ctx context.Context, req *gitalypb.UserSquashRequest
// We're now rebasing the end commit on top of the start commit. The resulting tree
// is then going to be the tree of the squashed commit.
- rebasedCommitID, err := s.git2go.Rebase(ctx, repo, git2go.RebaseCommand{
+ rebasedCommitID, err := s.git2goExecutor.Rebase(ctx, repo, git2go.RebaseCommand{
Repository: repoPath,
Committer: git2go.NewSignature(
string(req.GetUser().Name), string(req.GetUser().Email), commitDate,
diff --git a/internal/gitaly/service/operations/submodules.go b/internal/gitaly/service/operations/submodules.go
index e848160dd..68375c226 100644
--- a/internal/gitaly/service/operations/submodules.go
+++ b/internal/gitaly/service/operations/submodules.go
@@ -96,7 +96,7 @@ func (s *Server) userUpdateSubmodule(ctx context.Context, req *gitalypb.UserUpda
return nil, helper.ErrInvalidArgument(err)
}
- result, err := s.git2go.Submodule(ctx, quarantineRepo, git2go.SubmoduleCommand{
+ result, err := s.git2goExecutor.Submodule(ctx, quarantineRepo, git2go.SubmoduleCommand{
Repository: repoPath,
AuthorMail: string(req.GetUser().GetEmail()),
AuthorName: string(req.GetUser().GetName()),
diff --git a/internal/gitaly/service/operations/tags_test.go b/internal/gitaly/service/operations/tags_test.go
index 5ea5917bd..0b349195c 100644
--- a/internal/gitaly/service/operations/tags_test.go
+++ b/internal/gitaly/service/operations/tags_test.go
@@ -262,6 +262,7 @@ func TestUserCreateTagWithTransaction(t *testing.T) {
deps.GetTxManager(),
deps.GetLocator(),
deps.GetConnsPool(),
+ deps.GetGit2goExecutor(),
deps.GetGitCmdFactory(),
deps.GetCatfileCache(),
))
diff --git a/internal/gitaly/service/operations/testhelper_test.go b/internal/gitaly/service/operations/testhelper_test.go
index 4972b397a..16fd1b528 100644
--- a/internal/gitaly/service/operations/testhelper_test.go
+++ b/internal/gitaly/service/operations/testhelper_test.go
@@ -72,6 +72,7 @@ func runOperationServiceServer(t testing.TB, cfg config.Cfg, options ...testserv
deps.GetTxManager(),
deps.GetLocator(),
deps.GetConnsPool(),
+ deps.GetGit2goExecutor(),
deps.GetGitCmdFactory(),
deps.GetCatfileCache(),
)
@@ -87,6 +88,7 @@ func runOperationServiceServer(t testing.TB, cfg config.Cfg, options ...testserv
deps.GetGitCmdFactory(),
deps.GetCatfileCache(),
deps.GetConnsPool(),
+ deps.GetGit2goExecutor(),
))
gitalypb.RegisterRefServiceServer(srv, ref.NewServer(
deps.GetCfg(),
diff --git a/internal/gitaly/service/repository/apply_gitattributes_test.go b/internal/gitaly/service/repository/apply_gitattributes_test.go
index 88b15b543..685fafa02 100644
--- a/internal/gitaly/service/repository/apply_gitattributes_test.go
+++ b/internal/gitaly/service/repository/apply_gitattributes_test.go
@@ -105,6 +105,7 @@ func TestApplyGitattributesWithTransaction(t *testing.T) {
deps.GetGitCmdFactory(),
deps.GetCatfileCache(),
deps.GetConnsPool(),
+ deps.GetGit2goExecutor(),
))
})
diff --git a/internal/gitaly/service/repository/create_fork_test.go b/internal/gitaly/service/repository/create_fork_test.go
index 9f145d759..8c2f95ab3 100644
--- a/internal/gitaly/service/repository/create_fork_test.go
+++ b/internal/gitaly/service/repository/create_fork_test.go
@@ -15,6 +15,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/cache"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/catfile"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/git2go"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/hook"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/rubyserver"
@@ -274,7 +275,9 @@ func runSecureServer(t *testing.T, cfg config.Cfg, rubySrv *rubyserver.Server) s
connsPool := client.NewPool()
t.Cleanup(func() { testhelper.MustClose(t, connsPool) })
- gitalypb.RegisterRepositoryServiceServer(server, NewServer(cfg, rubySrv, locator, txManager, gitCmdFactory, catfileCache, connsPool))
+ git2goExecutor := git2go.NewExecutor(cfg, gitCmdFactory, locator)
+
+ gitalypb.RegisterRepositoryServiceServer(server, NewServer(cfg, rubySrv, locator, txManager, gitCmdFactory, catfileCache, connsPool, git2goExecutor))
gitalypb.RegisterHookServiceServer(server, hookservice.NewServer(cfg, hookManager, gitCmdFactory, nil))
gitalypb.RegisterRemoteServiceServer(server, remote.NewServer(cfg, locator, gitCmdFactory, catfileCache, txManager, connsPool))
gitalypb.RegisterSSHServiceServer(server, ssh.NewServer(cfg, locator, gitCmdFactory, txManager))
diff --git a/internal/gitaly/service/repository/fetch_bundle_test.go b/internal/gitaly/service/repository/fetch_bundle_test.go
index ebc407ecd..ba17b0e7b 100644
--- a/internal/gitaly/service/repository/fetch_bundle_test.go
+++ b/internal/gitaly/service/repository/fetch_bundle_test.go
@@ -86,6 +86,7 @@ func TestServer_FetchBundle_transaction(t *testing.T) {
deps.GetGitCmdFactory(),
deps.GetCatfileCache(),
deps.GetConnsPool(),
+ deps.GetGit2goExecutor(),
))
gitalypb.RegisterHookServiceServer(srv, hook.NewServer(
deps.GetCfg(),
diff --git a/internal/gitaly/service/repository/fetch_remote_test.go b/internal/gitaly/service/repository/fetch_remote_test.go
index 14e15331e..ddab4e3ee 100644
--- a/internal/gitaly/service/repository/fetch_remote_test.go
+++ b/internal/gitaly/service/repository/fetch_remote_test.go
@@ -193,6 +193,7 @@ func TestFetchRemote_transaction(t *testing.T) {
deps.GetGitCmdFactory(),
deps.GetCatfileCache(),
deps.GetConnsPool(),
+ deps.GetGit2goExecutor(),
))
}, testserver.WithTransactionManager(txManager))
diff --git a/internal/gitaly/service/repository/search_files_test.go b/internal/gitaly/service/repository/search_files_test.go
index bbeacded7..b2c962291 100644
--- a/internal/gitaly/service/repository/search_files_test.go
+++ b/internal/gitaly/service/repository/search_files_test.go
@@ -14,6 +14,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/backchannel"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/catfile"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/git2go"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/transaction"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
@@ -210,17 +211,22 @@ func TestSearchFilesByContentFailure(t *testing.T) {
catfileCache := catfile.NewCache(cfg)
t.Cleanup(catfileCache.Stop)
+ locator := config.NewLocator(cfg)
+
connsPool := client.NewPool()
defer testhelper.MustClose(t, connsPool)
+ git2goExecutor := git2go.NewExecutor(cfg, gitCommandFactory, locator)
+
server := NewServer(
cfg,
nil,
- config.NewLocator(cfg),
+ locator,
transaction.NewManager(cfg, backchannel.NewRegistry()),
gitCommandFactory,
catfileCache,
connsPool,
+ git2goExecutor,
)
testCases := []struct {
@@ -339,17 +345,22 @@ func TestSearchFilesByNameFailure(t *testing.T) {
catfileCache := catfile.NewCache(cfg)
t.Cleanup(catfileCache.Stop)
+ locator := config.NewLocator(cfg)
+
connsPool := client.NewPool()
defer testhelper.MustClose(t, connsPool)
+ git2goExecutor := git2go.NewExecutor(cfg, gitCommandFactory, locator)
+
server := NewServer(
cfg,
nil,
- config.NewLocator(cfg),
+ locator,
transaction.NewManager(cfg, backchannel.NewRegistry()),
gitCommandFactory,
catfileCache,
connsPool,
+ git2goExecutor,
)
testCases := []struct {
diff --git a/internal/gitaly/service/repository/server.go b/internal/gitaly/service/repository/server.go
index a946ece27..12210f9b3 100644
--- a/internal/gitaly/service/repository/server.go
+++ b/internal/gitaly/service/repository/server.go
@@ -16,16 +16,16 @@ import (
type server struct {
gitalypb.UnimplementedRepositoryServiceServer
- ruby *rubyserver.Server
- conns *client.Pool
- locator storage.Locator
- txManager transaction.Manager
- gitCmdFactory git.CommandFactory
- cfg config.Cfg
- binDir string
- loggingCfg config.Logging
- catfileCache catfile.Cache
- git2go git2go.Executor
+ ruby *rubyserver.Server
+ conns *client.Pool
+ locator storage.Locator
+ txManager transaction.Manager
+ gitCmdFactory git.CommandFactory
+ cfg config.Cfg
+ binDir string
+ loggingCfg config.Logging
+ catfileCache catfile.Cache
+ git2goExecutor *git2go.Executor
}
// NewServer creates a new instance of a gRPC repo server
@@ -37,18 +37,19 @@ func NewServer(
gitCmdFactory git.CommandFactory,
catfileCache catfile.Cache,
connsPool *client.Pool,
+ git2goExecutor *git2go.Executor,
) gitalypb.RepositoryServiceServer {
return &server{
- ruby: rs,
- locator: locator,
- txManager: txManager,
- gitCmdFactory: gitCmdFactory,
- conns: connsPool,
- cfg: cfg,
- binDir: cfg.BinDir,
- loggingCfg: cfg.Logging,
- catfileCache: catfileCache,
- git2go: git2go.NewExecutor(cfg, gitCmdFactory, locator),
+ ruby: rs,
+ locator: locator,
+ txManager: txManager,
+ gitCmdFactory: gitCmdFactory,
+ conns: connsPool,
+ cfg: cfg,
+ binDir: cfg.BinDir,
+ loggingCfg: cfg.Logging,
+ catfileCache: catfileCache,
+ git2goExecutor: git2goExecutor,
}
}
diff --git a/internal/gitaly/service/repository/testhelper_test.go b/internal/gitaly/service/repository/testhelper_test.go
index 6e22976c6..6f2cd2d7d 100644
--- a/internal/gitaly/service/repository/testhelper_test.go
+++ b/internal/gitaly/service/repository/testhelper_test.go
@@ -124,6 +124,7 @@ func runRepositoryServerWithConfig(t testing.TB, cfg config.Cfg, rubySrv *rubyse
deps.GetGitCmdFactory(),
deps.GetCatfileCache(),
deps.GetConnsPool(),
+ deps.GetGit2goExecutor(),
))
gitalypb.RegisterHookServiceServer(srv, hookservice.NewServer(cfg, deps.GetHookManager(), deps.GetGitCmdFactory(), deps.GetPackObjectsCache()))
gitalypb.RegisterRemoteServiceServer(srv, remote.NewServer(
diff --git a/internal/gitaly/service/setup/register.go b/internal/gitaly/service/setup/register.go
index eb3761251..77e5a1003 100644
--- a/internal/gitaly/service/setup/register.go
+++ b/internal/gitaly/service/setup/register.go
@@ -85,6 +85,7 @@ func RegisterAll(srv *grpc.Server, deps *service.Dependencies) {
deps.GetTxManager(),
deps.GetLocator(),
deps.GetConnsPool(),
+ deps.GetGit2goExecutor(),
deps.GetGitCmdFactory(),
deps.GetCatfileCache(),
))
@@ -103,6 +104,7 @@ func RegisterAll(srv *grpc.Server, deps *service.Dependencies) {
deps.GetGitCmdFactory(),
deps.GetCatfileCache(),
deps.GetConnsPool(),
+ deps.GetGit2goExecutor(),
))
gitalypb.RegisterSSHServiceServer(srv, ssh.NewServer(
deps.GetCfg(),
@@ -126,6 +128,7 @@ func RegisterAll(srv *grpc.Server, deps *service.Dependencies) {
deps.GetGitCmdFactory(),
deps.GetCatfileCache(),
deps.GetConnsPool(),
+ deps.GetGit2goExecutor(),
))
gitalypb.RegisterRemoteServiceServer(srv, remote.NewServer(
deps.GetCfg(),