mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Merge pull request #1828 from pre-commit/worktree_in_git
add test for worktree inside of .git dir
This commit is contained in:
commit
b3750cac62
1 changed files with 11 additions and 0 deletions
|
|
@ -38,6 +38,17 @@ def test_get_root_bare_worktree(tmpdir):
|
||||||
assert git.get_root() == os.path.abspath('.')
|
assert git.get_root() == os.path.abspath('.')
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_root_worktree_in_git(tmpdir):
|
||||||
|
src = tmpdir.join('src').ensure_dir()
|
||||||
|
cmd_output('git', 'init', str(src))
|
||||||
|
git_commit(cwd=str(src))
|
||||||
|
|
||||||
|
cmd_output('git', 'worktree', 'add', '.git/trees/foo', 'HEAD', cwd=src)
|
||||||
|
|
||||||
|
with src.join('.git/trees/foo').as_cwd():
|
||||||
|
assert git.get_root() == os.path.abspath('.')
|
||||||
|
|
||||||
|
|
||||||
def test_get_staged_files_deleted(in_git_dir):
|
def test_get_staged_files_deleted(in_git_dir):
|
||||||
in_git_dir.join('test').ensure()
|
in_git_dir.join('test').ensure()
|
||||||
cmd_output('git', 'add', 'test')
|
cmd_output('git', 'add', 'test')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue