t / t6031-merge-recursive.shon commit t3400 (rebase): whitespace cleanup (e877a4c)
   1#!/bin/sh
   2
   3test_description='merge-recursive: handle file mode'
   4. ./test-lib.sh
   5
   6if ! test "$(git config --bool core.filemode)" = false
   7then
   8        test_set_prereq FILEMODE
   9fi
  10
  11test_expect_success 'mode change in one branch: keep changed version' '
  12        : >file1 &&
  13        git add file1 &&
  14        git commit -m initial &&
  15        git checkout -b a1 master &&
  16        : >dummy &&
  17        git add dummy &&
  18        git commit -m a &&
  19        git checkout -b b1 master &&
  20        test_chmod +x file1 &&
  21        git commit -m b1 &&
  22        git checkout a1 &&
  23        git merge-recursive master -- a1 b1 &&
  24        git ls-files -s file1 | grep ^100755
  25'
  26
  27test_expect_success FILEMODE 'verify executable bit on file' '
  28        test -x file1
  29'
  30
  31test_expect_success 'mode change in both branches: expect conflict' '
  32        git reset --hard HEAD &&
  33        git checkout -b a2 master &&
  34        : >file2 &&
  35        H=$(git hash-object file2) &&
  36        test_chmod +x file2 &&
  37        git commit -m a2 &&
  38        git checkout -b b2 master &&
  39        : >file2 &&
  40        git add file2 &&
  41        git commit -m b2 &&
  42        git checkout a2 &&
  43        (
  44                git merge-recursive master -- a2 b2
  45                test $? = 1
  46        ) &&
  47        git ls-files -u >actual &&
  48        (
  49                echo "100755 $H 2       file2"
  50                echo "100644 $H 3       file2"
  51        ) >expect &&
  52        test_cmp actual expect &&
  53        git ls-files -s file2 | grep ^100755
  54'
  55
  56test_expect_success FILEMODE 'verify executable bit on file' '
  57        test -x file2
  58'
  59
  60test_done