t6036: add a failed conflict detection case with symlink add/add

Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Jun 30, 2018 at 21:11 UTC 81f5a2ce7bd9a4a7114e420ef4544cf7ce29ad9b
1 file changed +66
t/t6036-recursive-corner-cases.sh
+66
@@ -872,4 +872,70 @@ test_expect_failure 'check symlink modify/modify' '
872 )
873 '
874
875 +#
876 +# criss-cross with add/add of a symlink:
877 +#
878 +# B D
879 +# o---o
880 +# / \ / \
881 +# A o X ? F
882 +# \ / \ /
883 +# o---o
884 +# C E
885 +#
886 +# Commit A: No symlink or path exists yet
887 +# Commit B: set up symlink: fickle->disneyland
888 +# Commit C: set up symlink: fickle->home
889 +# Commit D: merge B&C, resolving in favor of B
890 +# Commit E: merge B&C, resolving in favor of C
891 +#
892 +# This is an obvious add/add conflict for the symlink 'fickle'. Can
893 +# git detect it?
894 +
895 +test_expect_success 'setup symlink add/add' '
896 + test_create_repo symlink-add-add &&
897 + (
898 + cd symlink-add-add &&
899 +
900 + touch ignoreme &&
901 + git add ignoreme &&
902 + git commit -m A &&
903 + git tag A &&
904 +
905 + git checkout -b B A &&
906 + test_ln_s_add disneyland fickle &&
907 + git commit -m B &&
908 +
909 + git checkout -b C A &&
910 + test_ln_s_add home fickle &&
911 + git add fickle &&
912 + git commit -m C &&
913 +
914 + git checkout -q B^0 &&
915 + git merge -s ours -m D C^0 &&
916 + git tag D &&
917 +
918 + git checkout -q C^0 &&
919 + git merge -s ours -m E B^0 &&
920 + git tag E
921 + )
922 +'
923 +
924 +test_expect_failure 'check symlink add/add' '
925 + (
926 + cd symlink-add-add &&
927 +
928 + git checkout D^0 &&
929 +
930 + test_must_fail git merge -s recursive E^0 &&
931 +
932 + git ls-files -s >out &&
933 + test_line_count = 2 out &&
934 + git ls-files -u >out &&
935 + test_line_count = 2 out &&
936 + git ls-files -o >out &&
937 + test_line_count = 1 out
938 + )
939 +'
940 +
941 test_done