Commit 8356bf7e1a7ef6fa68f1c918d03011bf774c9ffb

Etienne Samson 2018-06-29T14:39:14

tests: worktree/bare: test some paths

diff --git a/tests/worktree/bare.c b/tests/worktree/bare.c
index 04060c0..2a0e882 100644
--- a/tests/worktree/bare.c
+++ b/tests/worktree/bare.c
@@ -52,3 +52,21 @@ void test_worktree_bare__add(void)
 	git_worktree_free(wt);
 	git_repository_free(wtrepo);
 }
+
+void test_worktree_bare__repository_path(void)
+{
+	git_worktree *wt;
+	git_repository *wtrepo;
+
+	cl_git_pass(git_worktree_add(&wt, g_repo, "name", WORKTREE_REPO, NULL));
+	cl_assert_equal_s(git_worktree_path(wt), cl_git_sandbox_path(0, WORKTREE_REPO, NULL));
+
+	cl_git_pass(git_repository_open(&wtrepo, WORKTREE_REPO));
+	cl_assert_equal_s(git_repository_path(wtrepo), cl_git_sandbox_path(1, COMMON_REPO, "worktrees", "name", NULL));
+
+	cl_assert_equal_s(git_repository_commondir(g_repo), git_repository_commondir(wtrepo));
+	cl_assert_equal_s(git_repository_workdir(wtrepo), cl_git_sandbox_path(1, WORKTREE_REPO, NULL));
+
+	git_repository_free(wtrepo);
+	git_worktree_free(wt);
+}