summaryrefslogtreecommitdiffstats
path: root/tests/git_test.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-09-06 04:23:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-09-06 04:23:44 +0000
commit8b9f67e46f462980dd0877e752954a07bfecdb32 (patch)
tree7455f28cae7a78fdec431903475978bbff39f984 /tests/git_test.py
parentAdding upstream version 2.14.0. (diff)
downloadpre-commit-b0f922720c2060ea6bc9cbea527126ef3c213e45.tar.xz
pre-commit-b0f922720c2060ea6bc9cbea527126ef3c213e45.zip
Adding upstream version 2.15.0.upstream/2.15.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/git_test.py')
-rw-r--r--tests/git_test.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/git_test.py b/tests/git_test.py
index 51d5f8c..aa21880 100644
--- a/tests/git_test.py
+++ b/tests/git_test.py
@@ -139,6 +139,24 @@ def test_get_changed_files(in_git_dir):
assert files == []
+def test_get_changed_files_disparate_histories(in_git_dir):
+ """in modern versions of git, `...` does not fall back to full diff"""
+ git_commit()
+ in_git_dir.join('a.txt').ensure()
+ cmd_output('git', 'add', '.')
+ git_commit()
+ cmd_output('git', 'branch', '-m', 'branch1')
+
+ cmd_output('git', 'checkout', '--orphan', 'branch2')
+ cmd_output('git', 'rm', '-rf', '.')
+ in_git_dir.join('a.txt').ensure()
+ in_git_dir.join('b.txt').ensure()
+ cmd_output('git', 'add', '.')
+ git_commit()
+
+ assert git.get_changed_files('branch1', 'branch2') == ['b.txt']
+
+
@pytest.mark.parametrize(
('s', 'expected'),
(