summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2017-12-21 19:19:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-12-22 20:14:16 (GMT)
commiteab3f2850e7cc63a8087fbeae608a1b72ea70c7b (patch)
treef9aa7db390af8ce63c23e583a4cc54ba83389303 /t
parent3013dff8662eae06457fe6e5348dfe2270810ab2 (diff)
downloadgit-eab3f2850e7cc63a8087fbeae608a1b72ea70c7b.zip
git-eab3f2850e7cc63a8087fbeae608a1b72ea70c7b.tar.gz
git-eab3f2850e7cc63a8087fbeae608a1b72ea70c7b.tar.bz2
t6044: recursive can silently incorporate dirty changes in a merge
The recursive merge strategy has some special handling when the tree for the merge branch exactly matches the merge base, but that code path is missing checks for the index having changes relative to HEAD. Add a testcase covering this scenario. Reported-by: Andreas Krey <a.krey@gmx.de> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t6044-merge-unrelated-index-changes.sh26
1 files changed, 21 insertions, 5 deletions
diff --git a/t/t6044-merge-unrelated-index-changes.sh b/t/t6044-merge-unrelated-index-changes.sh
index 0102348..5e472be 100755
--- a/t/t6044-merge-unrelated-index-changes.sh
+++ b/t/t6044-merge-unrelated-index-changes.sh
@@ -6,18 +6,21 @@ test_description="merges with unrelated index changes"
# Testcase for some simple merges
# A
-# o-----o B
+# o-------o B
# \
-# \---o C
+# \-----o C
# \
-# \-o D
+# \---o D
# \
-# o E
+# \-o E
+# \
+# o F
# Commit A: some file a
# Commit B: adds file b, modifies end of a
# Commit C: adds file c
# Commit D: adds file d, modifies beginning of a
# Commit E: renames a->subdir/a, adds subdir/e
+# Commit F: empty commit
test_expect_success 'setup trivial merges' '
test_seq 1 10 >a &&
@@ -29,6 +32,7 @@ test_expect_success 'setup trivial merges' '
git branch C &&
git branch D &&
git branch E &&
+ git branch F &&
git checkout B &&
echo b >b &&
@@ -52,7 +56,10 @@ test_expect_success 'setup trivial merges' '
git mv a subdir/a &&
echo e >subdir/e &&
git add subdir &&
- test_tick && git commit -m E
+ test_tick && git commit -m E &&
+
+ git checkout F &&
+ test_tick && git commit --allow-empty -m F
'
test_expect_success 'ff update' '
@@ -105,6 +112,15 @@ test_expect_success 'recursive' '
test_must_fail git merge -s recursive C^0
'
+test_expect_failure 'recursive, when merge branch matches merge base' '
+ git reset --hard &&
+ git checkout B^0 &&
+
+ touch random_file && git add random_file &&
+
+ test_must_fail git merge -s recursive F^0
+'
+
test_expect_success 'octopus, unrelated file touched' '
git reset --hard &&
git checkout B^0 &&