t / t6031-merge-recursive.shon commit gitweb: make the supported snapshot formats array global (5e16684)
   1#!/bin/sh
   2
   3test_description='merge-recursive: handle file mode'
   4. ./test-lib.sh
   5
   6# Note that we follow "chmod +x F" with "update-index --chmod=+x F" to
   7# help filesystems that do not have the executable bit.
   8
   9test_expect_success 'mode change in one branch: keep changed version' '
  10        : >file1 &&
  11        git add file1 &&
  12        git commit -m initial &&
  13        git checkout -b a1 master &&
  14        : >dummy &&
  15        git add dummy &&
  16        git commit -m a &&
  17        git checkout -b b1 master &&
  18        chmod +x file1 &&
  19        git update-index --chmod=+x file1 &&
  20        git commit -m b1 &&
  21        git checkout a1 &&
  22        git merge-recursive master -- a1 b1 &&
  23        test -x file1
  24'
  25
  26test_expect_success 'mode change in both branches: expect conflict' '
  27        git reset --hard HEAD &&
  28        git checkout -b a2 master &&
  29        : >file2 &&
  30        H=$(git hash-object file2) &&
  31        chmod +x file2 &&
  32        git update-index --add --chmod=+x file2 &&
  33        git commit -m a2 &&
  34        git checkout -b b2 master &&
  35        : >file2 &&
  36        git add file2 &&
  37        git commit -m b2 &&
  38        git checkout a2 &&
  39        (
  40                git merge-recursive master -- a2 b2
  41                test $? = 1
  42        ) &&
  43        git ls-files -u >actual &&
  44        (
  45                echo "100755 $H 2       file2"
  46                echo "100644 $H 3       file2"
  47        ) >expect &&
  48        test_cmp actual expect &&
  49        test -x file2
  50'
  51
  52test_done