mirror of
https://github.com/git/git.git
synced 2026-03-22 06:30:09 +01:00
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>
This commit is contained in:
committed by
Junio C Hamano
parent
d4d1718080
commit
a79968bed1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user