summaryrefslogtreecommitdiff
path: root/tests/worktree/worktree.c
diff options
context:
space:
mode:
authorPeter Pettersson <boretrk@hotmail.com>2021-08-08 13:34:06 +0200
committerPeter Pettersson <boretrk@hotmail.com>2021-08-08 13:34:06 +0200
commitd095502ed797e20a73a00b65cc9d70d91f7d7ab4 (patch)
tree5a63802c3f19d82276af5f264e5d869be24d6208 /tests/worktree/worktree.c
parente96fc0283aea9afd02f64bdcb26613422e74dc3a (diff)
downloadlibgit2-d095502ed797e20a73a00b65cc9d70d91f7d7ab4.tar.gz
tests: don't generate false positives on empty path segments
Diffstat (limited to 'tests/worktree/worktree.c')
-rw-r--r--tests/worktree/worktree.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/worktree/worktree.c b/tests/worktree/worktree.c
index f2078a3f9..9b87bfae6 100644
--- a/tests/worktree/worktree.c
+++ b/tests/worktree/worktree.c
@@ -44,8 +44,9 @@ void test_worktree_worktree__list_with_invalid_worktree_dirs(void)
git_strarray wts;
size_t i, j, len;
- cl_git_pass(git_buf_printf(&path, "%s/worktrees/invalid",
- fixture.repo->commondir));
+ cl_git_pass(git_buf_joinpath(&path,
+ fixture.repo->commondir,
+ "worktrees/invalid"));
cl_git_pass(p_mkdir(path.ptr, 0755));
len = path.size;
@@ -145,9 +146,9 @@ void test_worktree_worktree__open_invalid_commondir(void)
git_buf buf = GIT_BUF_INIT, path = GIT_BUF_INIT;
cl_git_pass(git_buf_sets(&buf, "/path/to/nonexistent/commondir"));
- cl_git_pass(git_buf_printf(&path,
- "%s/worktrees/testrepo-worktree/commondir",
- fixture.repo->commondir));
+ cl_git_pass(git_buf_joinpath(&path,
+ fixture.repo->commondir,
+ "worktrees/testrepo-worktree/commondir"));
cl_git_pass(git_futils_writebuffer(&buf, path.ptr, O_RDWR, 0644));
cl_git_pass(git_worktree_lookup(&wt, fixture.repo, "testrepo-worktree"));
@@ -165,9 +166,9 @@ void test_worktree_worktree__open_invalid_gitdir(void)
git_buf buf = GIT_BUF_INIT, path = GIT_BUF_INIT;
cl_git_pass(git_buf_sets(&buf, "/path/to/nonexistent/gitdir"));
- cl_git_pass(git_buf_printf(&path,
- "%s/worktrees/testrepo-worktree/gitdir",
- fixture.repo->commondir));
+ cl_git_pass(git_buf_joinpath(&path,
+ fixture.repo->commondir,
+ "worktrees/testrepo-worktree/gitdir"));
cl_git_pass(git_futils_writebuffer(&buf, path.ptr, O_RDWR, 0644));
cl_git_pass(git_worktree_lookup(&wt, fixture.repo, "testrepo-worktree"));