mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-16 02:21:46 +04:00
Add a case test for get_git_dir() and get_git_common_dir()
This commit is contained in:
parent
eba15d128b
commit
cc9f8f66c8
1 changed files with 16 additions and 0 deletions
|
|
@ -38,6 +38,22 @@ def test_get_root_bare_worktree(tmpdir):
|
|||
assert git.get_root() == os.path.abspath('.')
|
||||
|
||||
|
||||
def test_get_git_dir(tmpdir):
|
||||
"""Regression test for #1972"""
|
||||
src = tmpdir.join('src').ensure_dir()
|
||||
cmd_output('git', 'init', str(src))
|
||||
git_commit(cwd=str(src))
|
||||
|
||||
worktree = tmpdir.join('worktree').ensure_dir()
|
||||
cmd_output('git', 'worktree', 'add', '../worktree', cwd=src)
|
||||
|
||||
with worktree.as_cwd():
|
||||
assert git.get_git_dir() == src.ensure_dir(
|
||||
'.git/worktrees/worktree',
|
||||
)
|
||||
assert git.get_git_common_dir() == src.ensure_dir('.git')
|
||||
|
||||
|
||||
def test_get_root_worktree_in_git(tmpdir):
|
||||
src = tmpdir.join('src').ensure_dir()
|
||||
cmd_output('git', 'init', str(src))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue