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:
authorJohn Cai <johncai86@gmail.com>2022-12-28 19:42:34 +0300
committerJohn Cai <johncai86@gmail.com>2022-12-28 19:42:34 +0300
commit0cb06fd9a258ca51ba502ce2d9802012ccf99217 (patch)
treecc3a3ba6402f879361932808c9d3cd6b4d701497
parent76940d0876a7cba058c39461fefc2d2013f841f1 (diff)
fixing gitaly/service/commit
-rw-r--r--internal/gitaly/service/commit/check_objects_exist_test.go30
-rw-r--r--internal/gitaly/service/commit/commit_messages_test.go17
-rw-r--r--internal/gitaly/service/commit/count_commits_test.go11
-rw-r--r--internal/gitaly/service/commit/count_diverging_commits_test.go12
-rw-r--r--internal/gitaly/service/commit/find_commit_test.go9
-rw-r--r--internal/gitaly/service/commit/find_commits_test.go5
-rw-r--r--internal/gitaly/service/commit/isancestor_test.go7
-rw-r--r--internal/gitaly/service/commit/last_commit_for_path_test.go7
-rw-r--r--internal/gitaly/service/commit/list_all_commits_test.go5
-rw-r--r--internal/gitaly/service/commit/list_last_commits_for_tree_test.go9
-rw-r--r--internal/gitaly/service/commit/testhelper_test.go11
-rw-r--r--internal/gitaly/service/commit/tree_entries_test.go11
12 files changed, 74 insertions, 60 deletions
diff --git a/internal/gitaly/service/commit/check_objects_exist_test.go b/internal/gitaly/service/commit/check_objects_exist_test.go
index 5df74d97d..b2e5b39fa 100644
--- a/internal/gitaly/service/commit/check_objects_exist_test.go
+++ b/internal/gitaly/service/commit/check_objects_exist_test.go
@@ -10,6 +10,7 @@ import (
"github.com/sirupsen/logrus/hooks/test"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v15/internal/git"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/v15/internal/structerr"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper/testserver"
@@ -25,16 +26,17 @@ func TestCheckObjectsExist(t *testing.T) {
logger, hook := test.NewNullLogger()
cfg, client := setupCommitService(t, ctx, testserver.WithLogger(logger))
- repo, repoPath := git.CreateRepository(t, ctx, cfg)
+ repoProto, _ := git.CreateRepository(t, ctx, cfg)
+ repo := localrepo.NewTestRepo(t, cfg, repoProto)
- commitID1 := WriteTestCommit(t, git, cfg, repoPath,
- git.WithBranch("master"), git.WithMessage("commit-1"))
+ commitID1 := localrepo.WriteTestCommit(t, repo,
+ localrepo.WithBranch("master"), localrepo.WithMessage("commit-1"))
- commitID2 := git.WriteTestCommit(t, cfg, repoPath,
- git.WithBranch("feature"), git.WithMessage("commit-2"), git.WithParents(commitID1),
+ commitID2 := localrepo.WriteTestCommit(t, repo,
+ localrepo.WithBranch("feature"), localrepo.WithMessage("commit-2"), localrepo.WithParents(commitID1),
)
- commitID3 := WriteTestCommit(t, git, cfg, repoPath,
- git.WithMessage("commit-3"), git.WithParents(commitID1))
+ commitID3 := localrepo.WriteTestCommit(t, repo,
+ localrepo.WithMessage("commit-3"), localrepo.WithParents(commitID1))
for _, tc := range []struct {
desc string
@@ -77,7 +79,7 @@ func TestCheckObjectsExist(t *testing.T) {
desc: "request without revisions",
requests: []*gitalypb.CheckObjectsExistRequest{
{
- Repository: repo,
+ Repository: repoProto,
},
},
},
@@ -85,7 +87,7 @@ func TestCheckObjectsExist(t *testing.T) {
desc: "commit ids and refs that exist",
requests: []*gitalypb.CheckObjectsExistRequest{
{
- Repository: repo,
+ Repository: repoProto,
Revisions: [][]byte{
[]byte(commitID1),
[]byte("master"),
@@ -107,7 +109,7 @@ func TestCheckObjectsExist(t *testing.T) {
desc: "ref and objects missing",
requests: []*gitalypb.CheckObjectsExistRequest{
{
- Repository: repo,
+ Repository: repoProto,
Revisions: [][]byte{
[]byte(commitID1),
[]byte("master"),
@@ -131,7 +133,7 @@ func TestCheckObjectsExist(t *testing.T) {
desc: "chunked input",
requests: []*gitalypb.CheckObjectsExistRequest{
{
- Repository: repo,
+ Repository: repoProto,
Revisions: [][]byte{
[]byte(commitID1),
},
@@ -163,7 +165,7 @@ func TestCheckObjectsExist(t *testing.T) {
desc: "invalid input",
requests: []*gitalypb.CheckObjectsExistRequest{
{
- Repository: repo,
+ Repository: repoProto,
Revisions: [][]byte{
[]byte("-not-a-rev"),
},
@@ -178,7 +180,7 @@ func TestCheckObjectsExist(t *testing.T) {
desc: "input with whitespace",
requests: []*gitalypb.CheckObjectsExistRequest{
{
- Repository: repo,
+ Repository: repoProto,
Revisions: [][]byte{
[]byte(fmt.Sprintf("%s\n%s", commitID1, commitID2)),
},
@@ -193,7 +195,7 @@ func TestCheckObjectsExist(t *testing.T) {
desc: "chunked invalid input",
requests: []*gitalypb.CheckObjectsExistRequest{
{
- Repository: repo,
+ Repository: repoProto,
Revisions: [][]byte{
[]byte(commitID1),
},
diff --git a/internal/gitaly/service/commit/commit_messages_test.go b/internal/gitaly/service/commit/commit_messages_test.go
index 40338f3f5..b58284d7f 100644
--- a/internal/gitaly/service/commit/commit_messages_test.go
+++ b/internal/gitaly/service/commit/commit_messages_test.go
@@ -8,7 +8,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
- "gitlab.com/gitlab-org/gitaly/v15/internal/git"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/v15/internal/helper"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb"
@@ -20,21 +20,22 @@ func TestSuccessfulGetCommitMessagesRequest(t *testing.T) {
t.Parallel()
ctx := testhelper.Context(t)
- cfg, repo, repoPath, client := setupCommitServiceWithRepo(t, ctx)
+ cfg, repoProto, _, client := setupCommitServiceWithRepo(t, ctx)
+ repo := localrepo.NewTestRepo(t, cfg, repoProto)
message1 := strings.Repeat("a\n", helper.MaxCommitOrTagMessageSize*2)
message2 := strings.Repeat("b\n", helper.MaxCommitOrTagMessageSize*2)
- commit1ID := WriteTestCommit(t, git, cfg, repoPath,
- git.WithBranch("local-big-commits"), git.WithMessage(message1))
+ commit1ID := localrepo.WriteTestCommit(t, repo,
+ localrepo.WithBranch("local-big-commits"), localrepo.WithMessage(message1))
- commit2ID := git.WriteTestCommit(t, cfg, repoPath,
- git.WithBranch("local-big-commits"), git.WithMessage(message2),
- git.WithParents(commit1ID),
+ commit2ID := localrepo.WriteTestCommit(t, repo,
+ localrepo.WithBranch("local-big-commits"), localrepo.WithMessage(message2),
+ localrepo.WithParents(commit1ID),
)
request := &gitalypb.GetCommitMessagesRequest{
- Repository: repo,
+ Repository: repoProto,
CommitIds: []string{commit1ID.String(), commit2ID.String()},
}
diff --git a/internal/gitaly/service/commit/count_commits_test.go b/internal/gitaly/service/commit/count_commits_test.go
index 6d3cae8ea..c10c7edc5 100644
--- a/internal/gitaly/service/commit/count_commits_test.go
+++ b/internal/gitaly/service/commit/count_commits_test.go
@@ -8,6 +8,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v15/internal/git"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -21,10 +22,10 @@ func TestSuccessfulCountCommitsRequest(t *testing.T) {
ctx := testhelper.Context(t)
cfg, repo1, _, client := setupCommitServiceWithRepo(t, ctx)
- repo2, repo2Path := git.CreateRepository(t, ctx, cfg)
-
- commitOID := createCommits(t, cfg, repo2Path, "master", 5, "")
- createCommits(t, cfg, repo2Path, "another-branch", 3, commitOID)
+ repo2Proto, _ := git.CreateRepository(t, ctx, cfg)
+ repo2 := localrepo.NewTestRepo(t, cfg, repo2Proto)
+ commitOID := createCommits(t, cfg, repo2, "master", 5, "")
+ createCommits(t, cfg, repo2, "another-branch", 3, commitOID)
literalOptions := &gitalypb.GlobalOptions{LiteralPathspecs: true}
@@ -113,7 +114,7 @@ func TestSuccessfulCountCommitsRequest(t *testing.T) {
},
{
desc: "all refs #1",
- repo: repo2,
+ repo: repo2Proto,
all: true,
count: 8,
},
diff --git a/internal/gitaly/service/commit/count_diverging_commits_test.go b/internal/gitaly/service/commit/count_diverging_commits_test.go
index 815188691..6d9626927 100644
--- a/internal/gitaly/service/commit/count_diverging_commits_test.go
+++ b/internal/gitaly/service/commit/count_diverging_commits_test.go
@@ -10,6 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v15/internal/git"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb"
@@ -30,13 +31,14 @@ func createRepoWithDivergentBranches(t *testing.T, ctx context.Context, cfg conf
f h
*/
- repo, repoPath := git.CreateRepository(t, ctx, cfg)
+ repoProto, _ := git.CreateRepository(t, ctx, cfg)
+ repo := localrepo.NewTestRepo(t, cfg, repoProto)
- mainCommitOID := createCommits(t, cfg, repoPath, "main", 2, "")
- createCommits(t, cfg, repoPath, leftBranchName, leftCommits, mainCommitOID)
- createCommits(t, cfg, repoPath, rightBranchName, rightCommits, mainCommitOID)
+ mainCommitOID := createCommits(t, cfg, repo, "main", 2, "")
+ createCommits(t, cfg, repo, leftBranchName, leftCommits, mainCommitOID)
+ createCommits(t, cfg, repo, rightBranchName, rightCommits, mainCommitOID)
- return repo
+ return repoProto
}
func TestSuccessfulCountDivergentCommitsRequest(t *testing.T) {
diff --git a/internal/gitaly/service/commit/find_commit_test.go b/internal/gitaly/service/commit/find_commit_test.go
index 2fcaff893..a218c14ae 100644
--- a/internal/gitaly/service/commit/find_commit_test.go
+++ b/internal/gitaly/service/commit/find_commit_test.go
@@ -9,6 +9,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v15/internal/git"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/v15/internal/helper"
"gitlab.com/gitlab-org/gitaly/v15/internal/structerr"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper"
@@ -24,12 +25,12 @@ func TestSuccessfulFindCommitRequest(t *testing.T) {
windows1251Message := testhelper.MustReadFile(t, "testdata/commit-c809470461118b7bcab850f6e9a7ca97ac42f8ea-message.txt")
ctx := testhelper.Context(t)
- cfg, repoProto, repoPath, client := setupCommitServiceWithRepo(t, ctx)
+ cfg, repoProto, _, client := setupCommitServiceWithRepo(t, ctx)
bigMessage := "An empty commit with REALLY BIG message\n\n" + strings.Repeat("MOAR!\n", 20*1024)
- bigCommitID := git.WriteTestCommit(t, cfg, repoPath,
- git.WithBranch("local-big-commits"), git.WithMessage(bigMessage),
- git.WithParents("60ecb67744cb56576c30214ff52294f8ce2def98"),
+ bigCommitID := localrepo.WriteTestCommit(t, localrepo.NewTestRepo(t, cfg, repoProto),
+ localrepo.WithBranch("local-big-commits"), localrepo.WithMessage(bigMessage),
+ localrepo.WithParents("60ecb67744cb56576c30214ff52294f8ce2def98"),
)
testCases := []struct {
diff --git a/internal/gitaly/service/commit/find_commits_test.go b/internal/gitaly/service/commit/find_commits_test.go
index 0bdd1b861..5a2325672 100644
--- a/internal/gitaly/service/commit/find_commits_test.go
+++ b/internal/gitaly/service/commit/find_commits_test.go
@@ -12,6 +12,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v15/internal/git"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -441,8 +442,8 @@ func TestSuccessfulFindCommitsRequestWithAltGitObjectDirs(t *testing.T) {
cfg, repo, repoPath, client := setupCommitServiceWithRepo(t, ctx)
altObjectsDir := "./alt-objects"
- commitID := WriteTestCommit(t, git, cfg, repoPath,
- git.WithAlternateObjectDirectory(filepath.Join(repoPath, altObjectsDir)))
+ commitID := localrepo.WriteTestCommit(t, localrepo.NewTestRepo(t, cfg, repo),
+ localrepo.WithAlternateObjectDirectory(filepath.Join(repoPath, altObjectsDir)))
testCases := []struct {
desc string
diff --git a/internal/gitaly/service/commit/isancestor_test.go b/internal/gitaly/service/commit/isancestor_test.go
index b6d101bf9..dd77aa383 100644
--- a/internal/gitaly/service/commit/isancestor_test.go
+++ b/internal/gitaly/service/commit/isancestor_test.go
@@ -9,6 +9,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v15/internal/git"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/v15/internal/helper/text"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb"
@@ -170,9 +171,9 @@ func TestSuccessfulIsAncestorRequestWithAltGitObjectDirs(t *testing.T) {
parentCommitID := git.ObjectID(text.ChompBytes(git.Exec(t, cfg, "-C", repoPath, "rev-parse", "--verify", "HEAD")))
altObjectsDir := "./alt-objects"
- commitID := WriteTestCommit(t, git, cfg, repoPath,
- git.WithParents(parentCommitID),
- git.WithAlternateObjectDirectory(filepath.Join(repoPath, altObjectsDir)))
+ commitID := localrepo.WriteTestCommit(t, localrepo.NewTestRepo(t, cfg, repo),
+ localrepo.WithParents(parentCommitID),
+ localrepo.WithAlternateObjectDirectory(filepath.Join(repoPath, altObjectsDir)))
testCases := []struct {
desc string
diff --git a/internal/gitaly/service/commit/last_commit_for_path_test.go b/internal/gitaly/service/commit/last_commit_for_path_test.go
index 5e2e64d66..cfab1970a 100644
--- a/internal/gitaly/service/commit/last_commit_for_path_test.go
+++ b/internal/gitaly/service/commit/last_commit_for_path_test.go
@@ -7,6 +7,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v15/internal/git"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/v15/internal/structerr"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb"
@@ -134,14 +135,14 @@ func TestSuccessfulLastCommitWithGlobCharacters(t *testing.T) {
t.Parallel()
ctx := testhelper.Context(t)
- cfg, repo, repoPath, client := setupCommitServiceWithRepo(t, ctx)
+ cfg, repo, _, client := setupCommitServiceWithRepo(t, ctx)
// This is an arbitrary blob known to exist in the test repository
const blobID = "c60514b6d3d6bf4bec1030f70026e34dfbd69ad5"
path := ":wq"
- commitID := WriteTestCommit(t, git, cfg, repoPath,
- git.WithTreeEntries(git.TreeEntry{
+ commitID := localrepo.WriteTestCommit(t, localrepo.NewTestRepo(t, cfg, repo),
+ localrepo.WithTreeEntries(git.TreeEntry{
Mode: "100644", Path: path, OID: git.ObjectID(blobID),
}))
diff --git a/internal/gitaly/service/commit/list_all_commits_test.go b/internal/gitaly/service/commit/list_all_commits_test.go
index 4a9ff3016..1630584eb 100644
--- a/internal/gitaly/service/commit/list_all_commits_test.go
+++ b/internal/gitaly/service/commit/list_all_commits_test.go
@@ -11,6 +11,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v15/internal/git"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -116,8 +117,8 @@ func TestListAllCommits(t *testing.T) {
// We cannot easily spawn a command with an object directory, so we just do so
// manually here and write the commit into the quarantine object directory.
- commitID := WriteTestCommit(t, git, cfg, repoPath,
- git.WithAlternateObjectDirectory(filepath.Join(repoPath, quarantineDir)))
+ commitID := localrepo.WriteTestCommit(t, localrepo.NewTestRepo(t, cfg, repo),
+ localrepo.WithAlternateObjectDirectory(filepath.Join(repoPath, quarantineDir)))
// We now expect only the quarantined commit to be returned.
stream, err = client.ListAllCommits(ctx, &gitalypb.ListAllCommitsRequest{
diff --git a/internal/gitaly/service/commit/list_last_commits_for_tree_test.go b/internal/gitaly/service/commit/list_last_commits_for_tree_test.go
index 4cd93eba0..6e8b0f0ac 100644
--- a/internal/gitaly/service/commit/list_last_commits_for_tree_test.go
+++ b/internal/gitaly/service/commit/list_last_commits_for_tree_test.go
@@ -10,6 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v15/internal/git"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -318,7 +319,7 @@ func TestNonUtf8ListLastCommitsForTreeRequest(t *testing.T) {
t.Parallel()
ctx := testhelper.Context(t)
- cfg, repo, repoPath, client := setupCommitServiceWithRepo(t, ctx)
+ cfg, repo, _, client := setupCommitServiceWithRepo(t, ctx)
// This is an arbitrary blob known to exist in the test repository
const blobID = "c60514b6d3d6bf4bec1030f70026e34dfbd69ad5"
@@ -326,8 +327,8 @@ func TestNonUtf8ListLastCommitsForTreeRequest(t *testing.T) {
nonUTF8Filename := "hello\x80world"
require.False(t, utf8.ValidString(nonUTF8Filename))
- commitID := WriteTestCommit(t, git, cfg, repoPath,
- git.WithTreeEntries(git.TreeEntry{
+ commitID := localrepo.WriteTestCommit(t, localrepo.NewTestRepo(t, cfg, repo),
+ localrepo.WithTreeEntries(git.TreeEntry{
Mode: "100644", Path: nonUTF8Filename, OID: blobID,
}))
@@ -350,7 +351,7 @@ func TestSuccessfulListLastCommitsForTreeRequestWithGlobCharacters(t *testing.T)
ctx := testhelper.Context(t)
cfg, repo, repoPath, client := setupCommitServiceWithRepo(t, ctx)
- commitID := WriteTestCommit(t, git, cfg, repoPath, git.WithTreeEntries(git.TreeEntry{
+ commitID := localrepo.WriteTestCommit(t, localrepo.NewTestRepo(t, cfg, repo), localrepo.WithTreeEntries(git.TreeEntry{
Path: ":wq", Mode: "040000", OID: git.WriteTree(t, cfg, repoPath, []git.TreeEntry{
{Path: "README.md", Mode: "100644", Content: "something"},
}),
diff --git a/internal/gitaly/service/commit/testhelper_test.go b/internal/gitaly/service/commit/testhelper_test.go
index e788c6973..dc379674c 100644
--- a/internal/gitaly/service/commit/testhelper_test.go
+++ b/internal/gitaly/service/commit/testhelper_test.go
@@ -10,6 +10,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v15/internal/git"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/service"
"gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/service/repository"
@@ -117,17 +118,17 @@ type gitCommitsGetter interface {
GetCommits() []*gitalypb.GitCommit
}
-func createCommits(tb testing.TB, cfg config.Cfg, repoPath, branch string, commitCount int, parent git.ObjectID) git.ObjectID {
+func createCommits(tb testing.TB, cfg config.Cfg, repo *localrepo.Repo, branch string, commitCount int, parent git.ObjectID) git.ObjectID {
for i := 0; i < commitCount; i++ {
var parents []git.ObjectID
if parent != "" {
parents = append(parents, parent)
}
- parent = git.WriteTestCommit(tb, cfg, repoPath,
- git.WithBranch(branch),
- git.WithMessage(fmt.Sprintf("%s branch Empty commit %d", branch, i)),
- git.WithParents(parents...),
+ parent = localrepo.WriteTestCommit(tb, repo,
+ localrepo.WithBranch(branch),
+ localrepo.WithMessage(fmt.Sprintf("%s branch Empty commit %d", branch, i)),
+ localrepo.WithParents(parents...),
)
}
diff --git a/internal/gitaly/service/commit/tree_entries_test.go b/internal/gitaly/service/commit/tree_entries_test.go
index ba5d438f5..e3f27b381 100644
--- a/internal/gitaly/service/commit/tree_entries_test.go
+++ b/internal/gitaly/service/commit/tree_entries_test.go
@@ -10,6 +10,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v15/internal/git"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/v15/internal/structerr"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb"
@@ -24,7 +25,7 @@ func TestGetTreeEntries_curlyBraces(t *testing.T) {
ctx := testhelper.Context(t)
cfg, repo, repoPath, client := setupCommitServiceWithRepo(t, ctx)
- commitID := WriteTestCommit(t, git, cfg, repoPath, git.WithTreeEntries(git.TreeEntry{
+ commitID := localrepo.WriteTestCommit(t, localrepo.NewTestRepo(t, cfg, repo), localrepo.WithTreeEntries(git.TreeEntry{
Path: "issue-46261", Mode: "040000", OID: git.WriteTree(t, cfg, repoPath, []git.TreeEntry{
{
Path: "folder", Mode: "040000", OID: git.WriteTree(t, cfg, repoPath, []git.TreeEntry{
@@ -591,7 +592,7 @@ func TestGetTreeEntries_deepFlatpath(t *testing.T) {
treeID = git.WriteTree(t, cfg, repoPath, []git.TreeEntry{treeEntry})
}
- commitID := WriteTestCommit(t, git, cfg, repoPath, git.WithTree(treeID))
+ commitID := localrepo.WriteTestCommit(t, localrepo.NewTestRepo(t, cfg, repo), localrepo.WithTree(treeID))
// We make a non-recursive request which tries to fetch tree entrie for the tree structure
// we have created above. This should return a single entry, which is the directory we're
@@ -623,10 +624,10 @@ func TestGetTreeEntries_file(t *testing.T) {
t.Parallel()
ctx := testhelper.Context(t)
- cfg, repo, repoPath, client := setupCommitServiceWithRepo(t, ctx)
+ cfg, repo, _, client := setupCommitServiceWithRepo(t, ctx)
- commitID := WriteTestCommit(t, git, cfg, repoPath,
- git.WithTreeEntries(git.TreeEntry{
+ commitID := localrepo.WriteTestCommit(t, localrepo.NewTestRepo(t, cfg, repo),
+ localrepo.WithTreeEntries(git.TreeEntry{
Mode: "100644",
Path: "README.md",
Content: "something with spaces in between",