There was an error while loading. Please reload this page.
1 parent 9ebf8b6 commit b754897Copy full SHA for b754897
1 file changed
test/test_repo.py
@@ -1476,6 +1476,17 @@ def test_git_work_tree_from_bare_repo(self, rw_dir):
1476
assert not repo.bare
1477
assert osp.samefile(repo.working_tree_dir, worktree_path)
1478
1479
+ # Discovering from a subdirectory (as tools such as mkdocs plugins do) and then
1480
+ # running a command with an absolute pathspec must use the worktree, not the
1481
+ # bare common dir, as the working directory; 3.1.61 failed here with
1482
+ # "is outside repository at '<bare_repo>/.'" (#2223).
1483
+ subdir = osp.join(worktree_path, "git", "repo")
1484
+ sub_repo = Repo(subdir, search_parent_directories=True)
1485
+ assert not sub_repo.bare
1486
+ assert osp.samefile(sub_repo.working_dir, worktree_path)
1487
+ expected = repo.git.log("-n", "1", "--format=%H", "--", "git/repo")
1488
+ assert sub_repo.git.log("-n", "1", "--format=%H", "--", subdir) == expected
1489
+
1490
def test_git_work_tree_dotgit_relative(self):
1491
"""Check that we find .git as a worktree file containing a relative path
1492
and find the worktree based on it."""
0 commit comments