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:
authorPavlo Strokov <pstrokov@gitlab.com>2021-04-21 16:57:34 +0300
committerPavlo Strokov <pstrokov@gitlab.com>2021-04-21 16:57:34 +0300
commit3ff8154b9555e501556f1e0668cb304932008154 (patch)
tree97c30d968307a5aaae1cb252ce78d9f17e3caeb1
parente30fb605f6c3bbbd42068b2cb2d53eb312f2d00f (diff)
Change gittest.CreateCommit to use provided configuration
The function gittest.CreateCommit changed to accept configuration as an input parameter and now uses Exec and ExecStream functions internally to run git commands. All dependencies aligned on that change. Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/2699
-rw-r--r--internal/git/gittest/commit.go11
-rw-r--r--internal/git/localrepo/remote_test.go2
-rw-r--r--internal/gitaly/service/commit/commit_messages_test.go6
-rw-r--r--internal/gitaly/service/commit/find_commit_test.go2
-rw-r--r--internal/gitaly/service/objectpool/fetch_into_object_pool_test.go2
-rw-r--r--internal/gitaly/service/objectpool/link_test.go2
-rw-r--r--internal/gitaly/service/operations/merge_test.go2
-rw-r--r--internal/gitaly/service/ref/refs_test.go4
-rw-r--r--internal/gitaly/service/remote/fetch_internal_remote_test.go2
-rw-r--r--internal/gitaly/service/remote/update_remote_mirror_test.go2
-rw-r--r--internal/gitaly/service/repository/clone_from_pool_internal_test.go2
-rw-r--r--internal/gitaly/service/repository/clone_from_pool_test.go2
-rw-r--r--internal/gitaly/service/repository/commit_graph_test.go3
-rw-r--r--internal/gitaly/service/repository/create_bundle_test.go2
-rw-r--r--internal/gitaly/service/repository/fetch_remote_test.go4
-rw-r--r--internal/gitaly/service/repository/fetch_test.go6
-rw-r--r--internal/gitaly/service/repository/midx_test.go2
-rw-r--r--internal/gitaly/service/repository/optimize_test.go2
-rw-r--r--internal/gitaly/service/repository/rename_test.go2
-rw-r--r--internal/gitaly/service/repository/repack_test.go2
-rw-r--r--internal/gitaly/service/repository/replicate_test.go2
-rw-r--r--internal/gitaly/service/repository/snapshot_test.go2
-rw-r--r--internal/gitaly/service/smarthttp/inforefs_test.go2
-rw-r--r--internal/gitaly/service/smarthttp/upload_pack_test.go3
-rw-r--r--internal/gitaly/service/ssh/receive_pack_test.go2
-rw-r--r--internal/praefect/info_service_test.go2
-rw-r--r--internal/praefect/replicator_test.go4
27 files changed, 41 insertions, 38 deletions
diff --git a/internal/git/gittest/commit.go b/internal/git/gittest/commit.go
index c17af3a58..0fb23da2e 100644
--- a/internal/git/gittest/commit.go
+++ b/internal/git/gittest/commit.go
@@ -12,7 +12,6 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/helper/text"
- "gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
)
@@ -28,7 +27,7 @@ const (
)
// CreateCommit makes a new empty commit and updates the named branch to point to it.
-func CreateCommit(t testing.TB, repoPath, branchName string, opts *CreateCommitOpts) string {
+func CreateCommit(t testing.TB, cfg config.Cfg, repoPath, branchName string, opts *CreateCommitOpts) string {
message := "message"
// The ID of an arbitrary commit known to exist in the test repository.
parentID := "1a0b36b3cdad1d2ee32457c102a8c0b7056fa863"
@@ -55,10 +54,10 @@ func CreateCommit(t testing.TB, repoPath, branchName string, opts *CreateCommitO
"-C", repoPath,
"commit-tree", "-F", "-", "-p", parentID, parentID + "^{tree}",
}
- newCommit := testhelper.MustRunCommand(t, stdin, "git", commitArgs...)
+ newCommit := ExecStream(t, cfg, stdin, commitArgs...)
newCommitID := text.ChompBytes(newCommit)
- testhelper.MustRunCommand(t, nil, "git", "-C", repoPath, "update-ref", "refs/heads/"+branchName, newCommitID)
+ Exec(t, cfg, "-C", repoPath, "update-ref", "refs/heads/"+branchName, newCommitID)
return newCommitID
}
@@ -108,12 +107,12 @@ func CommitBlobWithName(t testing.TB, cfg config.Cfg, testRepoPath, blobID, file
}
// CreateCommitOnNewBranch creates a branch and a commit, returning the commit sha and the branch name respectivelyi
-func CreateCommitOnNewBranch(t testing.TB, repoPath string) (string, string) {
+func CreateCommitOnNewBranch(t testing.TB, cfg config.Cfg, repoPath string) (string, string) {
nonce, err := text.RandomHex(4)
require.NoError(t, err)
newBranch := "branch-" + nonce
- sha := CreateCommit(t, repoPath, newBranch, &CreateCommitOpts{
+ sha := CreateCommit(t, cfg, repoPath, newBranch, &CreateCommitOpts{
Message: "a new branch and commit " + nonce,
})
diff --git a/internal/git/localrepo/remote_test.go b/internal/git/localrepo/remote_test.go
index adceefe2b..79c93a6a8 100644
--- a/internal/git/localrepo/remote_test.go
+++ b/internal/git/localrepo/remote_test.go
@@ -498,7 +498,7 @@ if [ -z ${GIT_SSH_COMMAND+x} ];then rm -f %q ;else echo -n "$GIT_SSH_COMMAND" >
require.NoError(t, err)
require.NoError(t, sourceRepo.Push(ctx, pushRepoPath, []string{"refs/*"}, PushOptions{}))
- divergedMaster := gittest.CreateCommit(t, pushRepoPath, "master", &gittest.CreateCommitOpts{
+ divergedMaster := gittest.CreateCommit(t, cfg, pushRepoPath, "master", &gittest.CreateCommitOpts{
ParentID: sourceMaster.Target,
})
diff --git a/internal/gitaly/service/commit/commit_messages_test.go b/internal/gitaly/service/commit/commit_messages_test.go
index 4b41a4e5a..fbb4ca916 100644
--- a/internal/gitaly/service/commit/commit_messages_test.go
+++ b/internal/gitaly/service/commit/commit_messages_test.go
@@ -14,7 +14,7 @@ import (
)
func TestSuccessfulGetCommitMessagesRequest(t *testing.T) {
- _, repo, repoPath, client := setupCommitServiceWithRepo(t, true)
+ cfg, repo, repoPath, client := setupCommitServiceWithRepo(t, true)
ctx, cancel := testhelper.Context()
defer cancel()
@@ -22,8 +22,8 @@ func TestSuccessfulGetCommitMessagesRequest(t *testing.T) {
message1 := strings.Repeat("a\n", helper.MaxCommitOrTagMessageSize*2)
message2 := strings.Repeat("b\n", helper.MaxCommitOrTagMessageSize*2)
- commit1ID := gittest.CreateCommit(t, repoPath, "local-big-commits", &gittest.CreateCommitOpts{Message: message1})
- commit2ID := gittest.CreateCommit(t, repoPath, "local-big-commits", &gittest.CreateCommitOpts{Message: message2, ParentID: commit1ID})
+ commit1ID := gittest.CreateCommit(t, cfg, repoPath, "local-big-commits", &gittest.CreateCommitOpts{Message: message1})
+ commit2ID := gittest.CreateCommit(t, cfg, repoPath, "local-big-commits", &gittest.CreateCommitOpts{Message: message2, ParentID: commit1ID})
request := &gitalypb.GetCommitMessagesRequest{
Repository: repo,
diff --git a/internal/gitaly/service/commit/find_commit_test.go b/internal/gitaly/service/commit/find_commit_test.go
index 50bf988b2..7f5182566 100644
--- a/internal/gitaly/service/commit/find_commit_test.go
+++ b/internal/gitaly/service/commit/find_commit_test.go
@@ -32,7 +32,7 @@ func TestSuccessfulFindCommitRequest(t *testing.T) {
defer cancel()
bigMessage := "An empty commit with REALLY BIG message\n\n" + strings.Repeat("MOAR!\n", 20*1024)
- bigCommitID := gittest.CreateCommit(t, repoPath, "local-big-commits", &gittest.CreateCommitOpts{
+ bigCommitID := gittest.CreateCommit(t, cfg, repoPath, "local-big-commits", &gittest.CreateCommitOpts{
Message: bigMessage,
ParentID: "60ecb67744cb56576c30214ff52294f8ce2def98",
})
diff --git a/internal/gitaly/service/objectpool/fetch_into_object_pool_test.go b/internal/gitaly/service/objectpool/fetch_into_object_pool_test.go
index 9dc3d9695..8e601a3ce 100644
--- a/internal/gitaly/service/objectpool/fetch_into_object_pool_test.go
+++ b/internal/gitaly/service/objectpool/fetch_into_object_pool_test.go
@@ -33,7 +33,7 @@ func TestFetchIntoObjectPool_Success(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- repoCommit := gittest.CreateCommit(t, repoPath, t.Name(), &gittest.CreateCommitOpts{Message: t.Name()})
+ repoCommit := gittest.CreateCommit(t, cfg, repoPath, t.Name(), &gittest.CreateCommitOpts{Message: t.Name()})
pool, err := objectpool.NewObjectPool(cfg, locator, git.NewExecCommandFactory(cfg), repo.GetStorageName(), gittest.NewObjectPoolName(t))
require.NoError(t, err)
diff --git a/internal/gitaly/service/objectpool/link_test.go b/internal/gitaly/service/objectpool/link_test.go
index aa2f1d175..2ca1dfd36 100644
--- a/internal/gitaly/service/objectpool/link_test.go
+++ b/internal/gitaly/service/objectpool/link_test.go
@@ -33,7 +33,7 @@ func TestLink(t *testing.T) {
// Mock object in the pool, which should be available to the pool members
// after linking
- poolCommitID := gittest.CreateCommit(t, pool.FullPath(), "pool-test-branch", nil)
+ poolCommitID := gittest.CreateCommit(t, cfg, pool.FullPath(), "pool-test-branch", nil)
testCases := []struct {
desc string
diff --git a/internal/gitaly/service/operations/merge_test.go b/internal/gitaly/service/operations/merge_test.go
index b70e79892..1ef299929 100644
--- a/internal/gitaly/service/operations/merge_test.go
+++ b/internal/gitaly/service/operations/merge_test.go
@@ -281,7 +281,7 @@ func TestFailedMergeConcurrentUpdate(t *testing.T) {
require.NoError(t, err, "receive first response")
// This concurrent update of the branch we are merging into should make the merge fail.
- concurrentCommitID := gittest.CreateCommit(t, repoPath, mergeBranchName, nil)
+ concurrentCommitID := gittest.CreateCommit(t, cfg, repoPath, mergeBranchName, nil)
require.NotEqual(t, firstResponse.CommitId, concurrentCommitID)
require.NoError(t, mergeBidi.Send(&gitalypb.UserMergeBranchRequest{Apply: true}), "apply merge")
diff --git a/internal/gitaly/service/ref/refs_test.go b/internal/gitaly/service/ref/refs_test.go
index 0419d0c39..cb2d9df0a 100644
--- a/internal/gitaly/service/ref/refs_test.go
+++ b/internal/gitaly/service/ref/refs_test.go
@@ -426,7 +426,7 @@ func TestSuccessfulFindAllTagsRequest(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- bigCommitID := gittest.CreateCommit(t, repoPath, "local-big-commits", &gittest.CreateCommitOpts{
+ bigCommitID := gittest.CreateCommit(t, cfg, repoPath, "local-big-commits", &gittest.CreateCommitOpts{
Message: "An empty commit with REALLY BIG message\n\n" + strings.Repeat("a", helper.MaxCommitOrTagMessageSize+1),
ParentID: "60ecb67744cb56576c30214ff52294f8ce2def98",
})
@@ -1291,7 +1291,7 @@ func TestSuccessfulFindTagRequest(t *testing.T) {
ctx, cancel := testhelper.Context()
defer cancel()
- bigCommitID := gittest.CreateCommit(t, repoPath, "local-big-commits", &gittest.CreateCommitOpts{
+ bigCommitID := gittest.CreateCommit(t, cfg, repoPath, "local-big-commits", &gittest.CreateCommitOpts{
Message: "An empty commit with REALLY BIG message\n\n" + strings.Repeat("a", helper.MaxCommitOrTagMessageSize+1),
ParentID: "60ecb67744cb56576c30214ff52294f8ce2def98",
})
diff --git a/internal/gitaly/service/remote/fetch_internal_remote_test.go b/internal/gitaly/service/remote/fetch_internal_remote_test.go
index 1f7847914..c7e413ed7 100644
--- a/internal/gitaly/service/remote/fetch_internal_remote_test.go
+++ b/internal/gitaly/service/remote/fetch_internal_remote_test.go
@@ -157,7 +157,7 @@ func TestSuccessfulFetchInternalRemote(t *testing.T) {
gitalypb.RegisterHookServiceServer(srv, hook.NewServer(deps.GetCfg(), deps.GetHookManager(), deps.GetGitCmdFactory()))
}, testserver.WithDisablePraefect())
- gittest.CreateCommit(t, remoteRepoPath, "master", nil)
+ gittest.CreateCommit(t, remoteCfg, remoteRepoPath, "master", nil)
localCfgBuilder := testcfg.NewGitalyCfgBuilder(testcfg.WithStorages("gitaly-1"))
t.Cleanup(localCfgBuilder.Cleanup)
diff --git a/internal/gitaly/service/remote/update_remote_mirror_test.go b/internal/gitaly/service/remote/update_remote_mirror_test.go
index 39e87537a..9056e11c3 100644
--- a/internal/gitaly/service/remote/update_remote_mirror_test.go
+++ b/internal/gitaly/service/remote/update_remote_mirror_test.go
@@ -470,7 +470,7 @@ func testSuccessfulUpdateRemoteMirrorRequestFeatured(t *testing.T, ctx context.C
Message: "Overriding tag", Force: true})
// Create a commit that only exists in the mirror
- mirrorOnlyCommitOid := gittest.CreateCommit(t, mirrorPath, "master", nil)
+ mirrorOnlyCommitOid := gittest.CreateCommit(t, cfg, mirrorPath, "master", nil)
require.NotEmpty(t, mirrorOnlyCommitOid)
setupCommands := [][]string{
diff --git a/internal/gitaly/service/repository/clone_from_pool_internal_test.go b/internal/gitaly/service/repository/clone_from_pool_internal_test.go
index 45894ce70..24ebb42b4 100644
--- a/internal/gitaly/service/repository/clone_from_pool_internal_test.go
+++ b/internal/gitaly/service/repository/clone_from_pool_internal_test.go
@@ -65,7 +65,7 @@ func TestCloneFromPoolInternal(t *testing.T) {
fullRepack(t, testRepoPath)
- _, newBranch := gittest.CreateCommitOnNewBranch(t, testRepoPath)
+ _, newBranch := gittest.CreateCommitOnNewBranch(t, config.Config, testRepoPath)
forkedRepo, forkRepoPath, forkRepoCleanup := getForkDestination(t)
defer forkRepoCleanup()
diff --git a/internal/gitaly/service/repository/clone_from_pool_test.go b/internal/gitaly/service/repository/clone_from_pool_test.go
index 3791cb576..267a3ee21 100644
--- a/internal/gitaly/service/repository/clone_from_pool_test.go
+++ b/internal/gitaly/service/repository/clone_from_pool_test.go
@@ -39,7 +39,7 @@ func TestCloneFromPoolHTTP(t *testing.T) {
fullRepack(t, testRepoPath)
- _, newBranch := gittest.CreateCommitOnNewBranch(t, testRepoPath)
+ _, newBranch := gittest.CreateCommitOnNewBranch(t, config.Config, testRepoPath)
forkedRepo, forkRepoPath, forkRepoCleanup := getForkDestination(t)
defer forkRepoCleanup()
diff --git a/internal/gitaly/service/repository/commit_graph_test.go b/internal/gitaly/service/repository/commit_graph_test.go
index 8dc962f57..cb684dab4 100644
--- a/internal/gitaly/service/repository/commit_graph_test.go
+++ b/internal/gitaly/service/repository/commit_graph_test.go
@@ -34,6 +34,7 @@ func TestWriteCommitGraph(t *testing.T) {
gittest.CreateCommit(
t,
+ config.Config,
testRepoPath,
t.Name(),
&gittest.CreateCommitOpts{Message: t.Name()},
@@ -62,6 +63,7 @@ func TestUpdateCommitGraph(t *testing.T) {
gittest.CreateCommit(
t,
+ config.Config,
testRepoPath,
t.Name(),
&gittest.CreateCommitOpts{Message: t.Name()},
@@ -86,6 +88,7 @@ func TestUpdateCommitGraph(t *testing.T) {
gittest.CreateCommit(
t,
+ config.Config,
testRepoPath,
t.Name(),
&gittest.CreateCommitOpts{Message: t.Name()},
diff --git a/internal/gitaly/service/repository/create_bundle_test.go b/internal/gitaly/service/repository/create_bundle_test.go
index be526d8e2..535bc5284 100644
--- a/internal/gitaly/service/repository/create_bundle_test.go
+++ b/internal/gitaly/service/repository/create_bundle_test.go
@@ -34,7 +34,7 @@ func TestSuccessfulCreateBundleRequest(t *testing.T) {
// create a work tree with a HEAD pointing to a commit that is missing.
// CreateBundle should clean this up before creating the bundle
- sha, branchName := gittest.CreateCommitOnNewBranch(t, testRepoPath)
+ sha, branchName := gittest.CreateCommitOnNewBranch(t, config.Config, testRepoPath)
require.NoError(t, os.MkdirAll(filepath.Join(testRepoPath, "gitlab-worktree"), 0755))
diff --git a/internal/gitaly/service/repository/fetch_remote_test.go b/internal/gitaly/service/repository/fetch_remote_test.go
index 6fa0ca65c..67102e5b8 100644
--- a/internal/gitaly/service/repository/fetch_remote_test.go
+++ b/internal/gitaly/service/repository/fetch_remote_test.go
@@ -400,8 +400,8 @@ func TestFetchRemote_force(t *testing.T) {
tagOID, err := sourceRepo.ResolveRevision(ctx, "refs/tags/v1.0.0")
require.NoError(t, err)
- divergingBranchOID, _ := gittest.CreateCommitOnNewBranch(t, sourceRepoPath)
- divergingTagOID, _ := gittest.CreateCommitOnNewBranch(t, sourceRepoPath)
+ divergingBranchOID, _ := gittest.CreateCommitOnNewBranch(t, config.Config, sourceRepoPath)
+ divergingTagOID, _ := gittest.CreateCommitOnNewBranch(t, config.Config, sourceRepoPath)
serverSocketPath, stop := runRepoServer(t, locator, testhelper.WithInternalSocket(config.Config))
defer stop()
diff --git a/internal/gitaly/service/repository/fetch_test.go b/internal/gitaly/service/repository/fetch_test.go
index a7160a0db..2f7e45abf 100644
--- a/internal/gitaly/service/repository/fetch_test.go
+++ b/internal/gitaly/service/repository/fetch_test.go
@@ -49,7 +49,7 @@ func TestFetchSourceBranchSourceRepositorySuccess(t *testing.T) {
defer cleanup()
sourceBranch := "fetch-source-branch-test-branch"
- newCommitID := gittest.CreateCommit(t, sourcePath, sourceBranch, nil)
+ newCommitID := gittest.CreateCommit(t, config.Config, sourcePath, sourceBranch, nil)
targetRef := "refs/tmp/fetch-source-branch-test"
req := &gitalypb.FetchSourceBranchRequest{
@@ -87,7 +87,7 @@ func TestFetchSourceBranchSameRepositorySuccess(t *testing.T) {
repo := localrepo.New(git.NewExecCommandFactory(config.Config), repoProto, config.Config)
sourceBranch := "fetch-source-branch-test-branch"
- newCommitID := gittest.CreateCommit(t, repoPath, sourceBranch, nil)
+ newCommitID := gittest.CreateCommit(t, config.Config, repoPath, sourceBranch, nil)
targetRef := "refs/tmp/fetch-source-branch-test"
req := &gitalypb.FetchSourceBranchRequest{
@@ -183,7 +183,7 @@ func TestFetchSourceBranchWrongRef(t *testing.T) {
defer cleanup()
sourceBranch := "fetch-source-branch-testmas-branch"
- gittest.CreateCommit(t, sourceRepoPath, sourceBranch, nil)
+ gittest.CreateCommit(t, config.Config, sourceRepoPath, sourceBranch, nil)
targetRef := "refs/tmp/fetch-source-branch-test"
diff --git a/internal/gitaly/service/repository/midx_test.go b/internal/gitaly/service/repository/midx_test.go
index d531e8fda..91e16e9b0 100644
--- a/internal/gitaly/service/repository/midx_test.go
+++ b/internal/gitaly/service/repository/midx_test.go
@@ -240,7 +240,7 @@ func addPackFiles(
// create some pack files with different sizes
for i := 0; i < packCount; i++ {
for y := packCount + 1 - i; y > 0; y-- {
- gittest.CreateCommitOnNewBranch(t, repoPath)
+ gittest.CreateCommitOnNewBranch(t, config.Config, repoPath)
}
_, err = client.RepackIncremental(ctx, &gitalypb.RepackIncrementalRequest{Repository: repo})
diff --git a/internal/gitaly/service/repository/optimize_test.go b/internal/gitaly/service/repository/optimize_test.go
index 7cc2f88e7..265d6c481 100644
--- a/internal/gitaly/service/repository/optimize_test.go
+++ b/internal/gitaly/service/repository/optimize_test.go
@@ -55,7 +55,7 @@ func TestOptimizeRepository(t *testing.T) {
// get timestamp of latest packfile
newestsPackfileTime := getNewestPackfileModtime(t, testRepoPath)
- gittest.CreateCommit(t, testRepoPath, "master", nil)
+ gittest.CreateCommit(t, config.Config, testRepoPath, "master", nil)
testhelper.MustRunCommand(t, nil, "git", "-C", testRepoPath, "config", "http.http://localhost:51744/60631c8695bf041a808759a05de53e36a73316aacb502824fabbb0c6055637c1.git.extraHeader", "Authorization: Basic secret-password")
testhelper.MustRunCommand(t, nil, "git", "-C", testRepoPath, "config", "http.http://localhost:51744/60631c8695bf041a808759a05de53e36a73316aacb502824fabbb0c6055637c2.git.extraHeader", "Authorization: Basic secret-password")
diff --git a/internal/gitaly/service/repository/rename_test.go b/internal/gitaly/service/repository/rename_test.go
index 1efe13275..f46823866 100644
--- a/internal/gitaly/service/repository/rename_test.go
+++ b/internal/gitaly/service/repository/rename_test.go
@@ -57,7 +57,7 @@ func TestRenameRepositoryDestinationExists(t *testing.T) {
destinationRepo, destinationRepoPath, cleanupDestinationRepo := gittest.CloneRepo(t)
defer cleanupDestinationRepo()
- _, sha := gittest.CreateCommitOnNewBranch(t, destinationRepoPath)
+ _, sha := gittest.CreateCommitOnNewBranch(t, config.Config, destinationRepoPath)
req := &gitalypb.RenameRepositoryRequest{Repository: testRepo, RelativePath: destinationRepo.GetRelativePath()}
diff --git a/internal/gitaly/service/repository/repack_test.go b/internal/gitaly/service/repository/repack_test.go
index cf81b4ab5..fe8026a6b 100644
--- a/internal/gitaly/service/repository/repack_test.go
+++ b/internal/gitaly/service/repository/repack_test.go
@@ -96,7 +96,7 @@ func TestRepackLocal(t *testing.T) {
altObjectsDir := "./alt-objects"
altDirsCommit := gittest.CreateCommitInAlternateObjectDirectory(t, config.Config.Git.BinPath, repoPath, altObjectsDir, cmd)
- repoCommit := gittest.CreateCommit(t, repoPath, t.Name(), &gittest.CreateCommitOpts{Message: t.Name()})
+ repoCommit := gittest.CreateCommit(t, config.Config, repoPath, t.Name(), &gittest.CreateCommitOpts{Message: t.Name()})
ctx, cancelFn := testhelper.Context()
defer cancelFn()
diff --git a/internal/gitaly/service/repository/replicate_test.go b/internal/gitaly/service/repository/replicate_test.go
index a4c863999..3d993edaa 100644
--- a/internal/gitaly/service/repository/replicate_test.go
+++ b/internal/gitaly/service/repository/replicate_test.go
@@ -97,7 +97,7 @@ func TestReplicateRepository(t *testing.T) {
require.Equal(t, string(attrData), string(replicatedAttrData), "info/attributes files must match")
// create another branch
- _, anotherNewBranch := gittest.CreateCommitOnNewBranch(t, testRepoPath)
+ _, anotherNewBranch := gittest.CreateCommitOnNewBranch(t, config.Config, testRepoPath)
_, err = repoClient.ReplicateRepository(injectedCtx, &gitalypb.ReplicateRepositoryRequest{
Repository: &targetRepo,
Source: testRepo,
diff --git a/internal/gitaly/service/repository/snapshot_test.go b/internal/gitaly/service/repository/snapshot_test.go
index 3ce7b4c65..f72f6cab6 100644
--- a/internal/gitaly/service/repository/snapshot_test.go
+++ b/internal/gitaly/service/repository/snapshot_test.go
@@ -63,7 +63,7 @@ func TestGetSnapshotSuccess(t *testing.T) {
// Ensure certain files exist in the test repo.
// CreateCommit produces a loose object with the given sha
- sha := gittest.CreateCommit(t, repoPath, "master", nil)
+ sha := gittest.CreateCommit(t, config.Config, repoPath, "master", nil)
zeroes := strings.Repeat("0", 40)
require.NoError(t, os.MkdirAll(filepath.Join(repoPath, "hooks"), 0755))
require.NoError(t, os.MkdirAll(filepath.Join(repoPath, "objects/pack"), 0755))
diff --git a/internal/gitaly/service/smarthttp/inforefs_test.go b/internal/gitaly/service/smarthttp/inforefs_test.go
index 2bdc6cf27..246ddc997 100644
--- a/internal/gitaly/service/smarthttp/inforefs_test.go
+++ b/internal/gitaly/service/smarthttp/inforefs_test.go
@@ -191,7 +191,7 @@ func TestObjectPoolRefAdvertisementHiding(t *testing.T) {
require.NoError(t, pool.Remove(ctx))
}()
- commitID := gittest.CreateCommit(t, pool.FullPath(), t.Name(), nil)
+ commitID := gittest.CreateCommit(t, config.Config, pool.FullPath(), t.Name(), nil)
require.NoError(t, pool.Link(ctx, repo))
diff --git a/internal/gitaly/service/smarthttp/upload_pack_test.go b/internal/gitaly/service/smarthttp/upload_pack_test.go
index da704408d..4e2e9db37 100644
--- a/internal/gitaly/service/smarthttp/upload_pack_test.go
+++ b/internal/gitaly/service/smarthttp/upload_pack_test.go
@@ -18,6 +18,7 @@ import (
"gitlab.com/gitlab-org/gitaly/internal/git"
"gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/pktline"
+ "gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/internal/testhelper/testcfg"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
@@ -440,7 +441,7 @@ func TestUploadPackRequestForPartialCloneSuccess(t *testing.T) {
gittest.GitObjectMustNotExist(t, cfg.Git.BinPath, localRepoPath, blobGreaterThanLimit)
newBranch := "new-branch"
- newHead = []byte(gittest.CreateCommit(t, remoteRepoPath, newBranch, &gittest.CreateCommitOpts{
+ newHead = []byte(gittest.CreateCommit(t, config.Config, remoteRepoPath, newBranch, &gittest.CreateCommitOpts{
Message: commitMsg,
}))
diff --git a/internal/gitaly/service/ssh/receive_pack_test.go b/internal/gitaly/service/ssh/receive_pack_test.go
index 389624a42..f35adec0b 100644
--- a/internal/gitaly/service/ssh/receive_pack_test.go
+++ b/internal/gitaly/service/ssh/receive_pack_test.go
@@ -230,7 +230,7 @@ func TestObjectPoolRefAdvertisementHidingSSH(t *testing.T) {
require.NoError(t, pool.Link(ctx, repo))
- commitID := gittest.CreateCommit(t, pool.FullPath(), t.Name(), nil)
+ commitID := gittest.CreateCommit(t, cfg, pool.FullPath(), t.Name(), nil)
// First request
require.NoError(t, stream.Send(&gitalypb.SSHReceivePackRequest{
diff --git a/internal/praefect/info_service_test.go b/internal/praefect/info_service_test.go
index 48fcdebf9..df9c16b70 100644
--- a/internal/praefect/info_service_test.go
+++ b/internal/praefect/info_service_test.go
@@ -69,7 +69,7 @@ func TestInfoService_RepositoryReplicas(t *testing.T) {
gittest.CloneRepoAtStorageRoot(t, cfg.Storages[2].Path, "repo-1")
// create a commit in the second replica so we can check that its checksum is different than the primary
- gittest.CreateCommit(t, filepath.Join(cfg.Storages[1].Path, "repo-1"), "master", nil)
+ gittest.CreateCommit(t, cfg, filepath.Join(cfg.Storages[1].Path, "repo-1"), "master", nil)
nodeManager, err := nodes.NewManager(testhelper.DiscardTestEntry(t), conf, nil, nil, promtest.NewMockHistogramVec(), protoregistry.GitalyProtoPreregistered, nil, nil)
require.NoError(t, err)
diff --git a/internal/praefect/replicator_test.go b/internal/praefect/replicator_test.go
index e209efe53..80ec36d48 100644
--- a/internal/praefect/replicator_test.go
+++ b/internal/praefect/replicator_test.go
@@ -193,7 +193,7 @@ func TestReplMgr_ProcessBacklog(t *testing.T) {
}
require.Len(t, events, 1)
- commitID := gittest.CreateCommit(t, testRepoPath, "master", &gittest.CreateCommitOpts{
+ commitID := gittest.CreateCommit(t, gitaly_config.Config, testRepoPath, "master", &gittest.CreateCommitOpts{
Message: "a commit",
})
@@ -568,7 +568,7 @@ func TestConfirmReplication(t *testing.T) {
require.NoError(t, err)
require.True(t, equal)
- gittest.CreateCommit(t, testRepoAPath, "master", &gittest.CreateCommitOpts{
+ gittest.CreateCommit(t, gitaly_config.Config, testRepoAPath, "master", &gittest.CreateCommitOpts{
Message: "a commit",
})