summaryrefslogtreecommitdiff
path: root/t/t6036-recursive-corner-cases.sh
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2018-07-01 04:11:20 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-07-03 21:43:43 (GMT)
commita79968bed184029139ddcd0a4e8171a2c84852ee (patch)
tree428c0bbde1116a1c7bfcb5816121a7ce783fc861 /t/t6036-recursive-corner-cases.sh
parentd4d17180808437fd732a9d14388657b8f609ad4a (diff)
downloadgit-a79968bed184029139ddcd0a4e8171a2c84852ee.zip
git-a79968bed184029139ddcd0a4e8171a2c84852ee.tar.gz
git-a79968bed184029139ddcd0a4e8171a2c84852ee.tar.bz2
t6036: add a failed conflict detection case with submodule add/add
Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6036-recursive-corner-cases.sh')
-rwxr-xr-xt/t6036-recursive-corner-cases.sh88
1 files changed, 88 insertions, 0 deletions
diff --git a/t/t6036-recursive-corner-cases.sh b/t/t6036-recursive-corner-cases.sh
index 0c8f813..e920c75 100755
--- a/t/t6036-recursive-corner-cases.sh
+++ b/t/t6036-recursive-corner-cases.sh
@@ -1026,4 +1026,92 @@ test_expect_failure 'check submodule modify/modify' '
)
'
+#
+# criss-cross with add/add on a submodule:
+#
+# B D
+# o---o
+# / \ / \
+# A o X ? F
+# \ / \ /
+# o---o
+# C E
+#
+# Commit A: nothing of note
+# Commit B: introduce submodule repo
+# Commit C: introduce submodule repo at different commit
+# Commit D: merge B&C, resolving in favor of B
+# Commit E: merge B&C, resolving in favor of C
+#
+# This is an obvious add/add conflict for the submodule 'repo'. Can
+# git detect it?
+
+test_expect_success 'setup submodule add/add' '
+ test_create_repo submodule-add-add &&
+ (
+ cd submodule-add-add &&
+
+ test_create_repo submod &&
+ (
+ cd submod &&
+ touch file-A &&
+ git add file-A &&
+ git commit -m A &&
+ git tag A &&
+
+ git checkout -b B A &&
+ touch file-B &&
+ git add file-B &&
+ git commit -m B &&
+ git tag B &&
+
+ git checkout -b C A &&
+ touch file-C &&
+ git add file-C &&
+ git commit -m C &&
+ git tag C
+ ) &&
+
+ touch irrelevant-file &&
+ git add irrelevant-file &&
+ git commit -m A &&
+ git tag A &&
+
+ git checkout -b B A &&
+ git -C submod reset --hard B &&
+ git add submod &&
+ git commit -m B &&
+
+ git checkout -b C A &&
+ git -C submod reset --hard C &&
+ git add submod &&
+ git commit -m C &&
+
+ git checkout -q B^0 &&
+ git merge -s ours -m D C^0 &&
+ git tag D &&
+
+ git checkout -q C^0 &&
+ git merge -s ours -m E B^0 &&
+ git tag E
+ )
+'
+
+test_expect_failure 'check submodule add/add' '
+ (
+ cd submodule-add-add &&
+
+ git checkout D^0 &&
+
+ test_must_fail git merge -s recursive E^0 &&
+
+ git ls-files -s >out &&
+ test_line_count = 3 out &&
+ git ls-files -u >out &&
+ test_line_count = 2 out &&
+ git ls-files -o >out &&
+ test_line_count = 1 out
+ )
+'
+
test_done