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-27 20:27:16 +0300
committerPavlo Strokov <pstrokov@gitlab.com>2021-04-29 22:14:15 +0300
commite1bc499a18e84c0fdc9842062ded51f602298f08 (patch)
treeabc1c3c68e089e1e5aaca570b65195aaafd06d3e
parentd266053b3f0cc26c82cea5626c2da8d495485d83 (diff)
Replace MustRunCommand with Exec in AddWorktree
Usages of the MustRunCommand replaced with Exec in order to break dependency on the global config.Config variable. Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/2699
-rw-r--r--internal/git/gittest/repo.go4
-rw-r--r--internal/gitaly/service/repository/cleanup_test.go6
2 files changed, 5 insertions, 5 deletions
diff --git a/internal/git/gittest/repo.go b/internal/git/gittest/repo.go
index e6406fcaf..17cf06079 100644
--- a/internal/git/gittest/repo.go
+++ b/internal/git/gittest/repo.go
@@ -186,6 +186,6 @@ func AddWorktreeArgs(repoPath, worktreeName string) []string {
}
// AddWorktree creates a worktree in the repository path for tests
-func AddWorktree(t testing.TB, repoPath string, worktreeName string) {
- testhelper.MustRunCommand(t, nil, "git", AddWorktreeArgs(repoPath, worktreeName)...)
+func AddWorktree(t testing.TB, cfg config.Cfg, repoPath string, worktreeName string) {
+ Exec(t, cfg, AddWorktreeArgs(repoPath, worktreeName)...)
}
diff --git a/internal/gitaly/service/repository/cleanup_test.go b/internal/gitaly/service/repository/cleanup_test.go
index 24b762c3d..9226bbec6 100644
--- a/internal/gitaly/service/repository/cleanup_test.go
+++ b/internal/gitaly/service/repository/cleanup_test.go
@@ -148,7 +148,7 @@ func TestCleanupDeletesStaleWorktrees(t *testing.T) {
req := &gitalypb.CleanupRequest{Repository: repo}
worktreeCheckoutPath := filepath.Join(repoPath, worktreePrefix, "test-worktree")
- gittest.AddWorktree(t, repoPath, worktreeCheckoutPath)
+ gittest.AddWorktree(t, cfg, repoPath, worktreeCheckoutPath)
basePath := filepath.Join(repoPath, "worktrees")
worktreePath := filepath.Join(basePath, "test-worktree")
@@ -193,7 +193,7 @@ func TestCleanupDisconnectedWorktrees(t *testing.T) {
req := &gitalypb.CleanupRequest{Repository: repo}
- gittest.AddWorktree(t, repoPath, worktreePath)
+ gittest.AddWorktree(t, cfg, repoPath, worktreePath)
ctx, cancel := testhelper.Context()
defer cancel()
@@ -216,7 +216,7 @@ func TestCleanupDisconnectedWorktrees(t *testing.T) {
// if the worktree administrative files are pruned, then we should be able
// to checkout another worktree at the same path
- gittest.AddWorktree(t, repoPath, worktreePath)
+ gittest.AddWorktree(t, cfg, repoPath, worktreePath)
}
func TestCleanupFileLocks(t *testing.T) {