Code

Merge branch 'maint'
[git.git] / t / t6031-merge-recursive.sh
index 41c6860be239a2abbab8b66ad8d4909b8913a9cc..bd75e0e6430ff6e536f0b10d28cc4793d0f7fe6c 100755 (executable)
@@ -3,6 +3,11 @@
 test_description='merge-recursive: handle file mode'
 . ./test-lib.sh
 
+if ! test "$(git config --bool core.filemode)" = false
+then
+       test_set_prereq FILEMODE
+fi
+
 test_expect_success 'mode change in one branch: keep changed version' '
        : >file1 &&
        git add file1 &&
@@ -16,6 +21,10 @@ test_expect_success 'mode change in one branch: keep changed version' '
        git commit -m b1 &&
        git checkout a1 &&
        git merge-recursive master -- a1 b1 &&
+       git ls-files -s file1 | grep ^100755
+'
+
+test_expect_success FILEMODE 'verify executable bit on file' '
        test -x file1
 '
 
@@ -41,7 +50,42 @@ test_expect_success 'mode change in both branches: expect conflict' '
                echo "100644 $H 3       file2"
        ) >expect &&
        test_cmp actual expect &&
+       git ls-files -s file2 | grep ^100755
+'
+
+test_expect_success FILEMODE 'verify executable bit on file' '
        test -x file2
 '
 
+test_expect_success 'merging with triple rename across D/F conflict' '
+       git reset --hard HEAD &&
+       git checkout -b main &&
+       git rm -rf . &&
+
+       echo "just a file" >sub1 &&
+       mkdir -p sub2 &&
+       echo content1 >sub2/file1 &&
+       echo content2 >sub2/file2 &&
+       echo content3 >sub2/file3 &&
+       mkdir simple &&
+       echo base >simple/bar &&
+       git add -A &&
+       test_tick &&
+       git commit -m base &&
+
+       git checkout -b other &&
+       echo more >>simple/bar &&
+       test_tick &&
+       git commit -a -m changesimplefile &&
+
+       git checkout main &&
+       git rm sub1 &&
+       git mv sub2 sub1 &&
+       test_tick &&
+       git commit -m changefiletodir &&
+
+       test_tick &&
+       git merge other
+'
+
 test_done