Skip to content

Commit 8356bf7

Browse files
committed
tests: worktree/bare: test some paths
1 parent d092112 commit 8356bf7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/worktree/bare.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,21 @@ void test_worktree_bare__add(void)
5252
git_worktree_free(wt);
5353
git_repository_free(wtrepo);
5454
}
55+
56+
void test_worktree_bare__repository_path(void)
57+
{
58+
git_worktree *wt;
59+
git_repository *wtrepo;
60+
61+
cl_git_pass(git_worktree_add(&wt, g_repo, "name", WORKTREE_REPO, NULL));
62+
cl_assert_equal_s(git_worktree_path(wt), cl_git_sandbox_path(0, WORKTREE_REPO, NULL));
63+
64+
cl_git_pass(git_repository_open(&wtrepo, WORKTREE_REPO));
65+
cl_assert_equal_s(git_repository_path(wtrepo), cl_git_sandbox_path(1, COMMON_REPO, "worktrees", "name", NULL));
66+
67+
cl_assert_equal_s(git_repository_commondir(g_repo), git_repository_commondir(wtrepo));
68+
cl_assert_equal_s(git_repository_workdir(wtrepo), cl_git_sandbox_path(1, WORKTREE_REPO, NULL));
69+
70+
git_repository_free(wtrepo);
71+
git_worktree_free(wt);
72+
}

0 commit comments

Comments
 (0)