Skip to content

Commit 83c35f7

Browse files
committed
tests: worktree/bare: fix git_worktree_validate
1 parent bd40f0d commit 83c35f7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/worktree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ int git_worktree_validate(const git_worktree *wt)
248248
goto out;
249249
}
250250

251-
if (!git_path_exists(wt->parent_path)) {
251+
if (wt->parent_path && !git_path_exists(wt->parent_path)) {
252252
giterr_set(GITERR_WORKTREE,
253253
"Worktree parent directory ('%s') does not exist ",
254254
wt->parent_path);

tests/worktree/bare.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ void test_worktree_bare__add(void)
4242
cl_git_pass(git_worktree_list(&wts, g_repo));
4343
cl_assert_equal_i(wts.count, 1);
4444

45+
cl_git_pass(git_worktree_validate(wt));
46+
4547
cl_git_pass(git_repository_open(&wtrepo, WORKTREE_REPO));
4648
cl_assert_equal_i(0, git_repository_is_bare(wtrepo));
4749
cl_assert_equal_i(1, git_repository_is_worktree(wtrepo));

0 commit comments

Comments
 (0)