Skip to content

Commit 14d3af2

Browse files
committed
add test for worktree inside of .git dir
1 parent 19bffaa commit 14d3af2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/git_test.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ def test_get_root_bare_worktree(tmpdir):
3838
assert git.get_root() == os.path.abspath('.')
3939

4040

41+
def test_get_root_worktree_in_git(tmpdir):
42+
src = tmpdir.join('src').ensure_dir()
43+
cmd_output('git', 'init', str(src))
44+
git_commit(cwd=str(src))
45+
46+
cmd_output('git', 'worktree', 'add', '.git/trees/foo', 'HEAD', cwd=src)
47+
48+
with src.join('.git/trees/foo').as_cwd():
49+
assert git.get_root() == os.path.abspath('.')
50+
51+
4152
def test_get_staged_files_deleted(in_git_dir):
4253
in_git_dir.join('test').ensure()
4354
cmd_output('git', 'add', 'test')

0 commit comments

Comments
 (0)