summaryrefslogtreecommitdiffstats
path: root/tests/git_test.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-03-08 17:48:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-03-08 17:49:10 +0000
commit84c011ae6133fb007046d8eb66c01d0de80b3500 (patch)
tree60b2be37885c99f0bf69434223b01cc5a2b92203 /tests/git_test.py
parentReleasing debian version 2.10.1-1. (diff)
downloadpre-commit-84c011ae6133fb007046d8eb66c01d0de80b3500.tar.xz
pre-commit-84c011ae6133fb007046d8eb66c01d0de80b3500.zip
Merging upstream version 2.11.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/git_test.py')
-rw-r--r--tests/git_test.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/git_test.py b/tests/git_test.py
index 69fd206..51d5f8c 100644
--- a/tests/git_test.py
+++ b/tests/git_test.py
@@ -38,6 +38,17 @@ def test_get_root_bare_worktree(tmpdir):
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):
in_git_dir.join('test').ensure()
cmd_output('git', 'add', 'test')