66d3647bdad7a5bc0e9fb2d15bfa3909138b5501
   1#!/bin/sh
   2
   3test_description='Various filesystem issues'
   4
   5. ./test-lib.sh
   6
   7auml=`printf '\xc3\xa4'`
   8aumlcdiar=`printf '\x61\xcc\x88'`
   9
  10case_insensitive=
  11test_expect_success 'see if we expect ' '
  12
  13        test_case=test_expect_success
  14        test_unicode=test_expect_success
  15        mkdir junk &&
  16        echo good >junk/CamelCase &&
  17        echo bad >junk/camelcase &&
  18        if test "$(cat junk/CamelCase)" != good
  19        then
  20                test_case=test_expect_failure
  21                case_insensitive=t
  22                say "will test on a case insensitive filesystem"
  23        fi &&
  24        rm -fr junk &&
  25        mkdir junk &&
  26        >junk/"$auml" &&
  27        case "$(cd junk && echo *)" in
  28        "$aumlcdiar")
  29                test_unicode=test_expect_failure
  30                say "will test on a unicode corrupting filesystem"
  31                ;;
  32        *)      ;;
  33        esac &&
  34        rm -fr junk
  35'
  36
  37if test "$case_insensitive"
  38then
  39test_expect_success "detection of case insensitive filesystem during repo init" '
  40
  41        test $(git config --bool core.ignorecase) = true
  42'
  43else
  44test_expect_success "detection of case insensitive filesystem during repo init" '
  45
  46        ! git config --bool core.ignorecase >/dev/null ||
  47        test $(git config --bool core.ignorecase) = false
  48'
  49fi
  50
  51test_expect_success "setup case tests" '
  52
  53        touch camelcase &&
  54        git add camelcase &&
  55        git commit -m "initial" &&
  56        git tag initial &&
  57        git checkout -b topic &&
  58        git mv camelcase tmp &&
  59        git mv tmp CamelCase &&
  60        git commit -m "rename" &&
  61        git checkout -f master
  62
  63'
  64
  65$test_case 'rename (case change)' '
  66
  67        git mv camelcase CamelCase &&
  68        git commit -m "rename"
  69
  70'
  71
  72$test_case 'merge (case change)' '
  73
  74        git reset --hard initial &&
  75        git merge topic
  76
  77'
  78
  79test_expect_success "setup unicode normalization tests" '
  80
  81  test_create_repo unicode &&
  82  cd unicode &&
  83  touch "$aumlcdiar" &&
  84  git add "$aumlcdiar" &&
  85  git commit -m initial
  86  git tag initial &&
  87  git checkout -b topic &&
  88  git mv $aumlcdiar tmp &&
  89  git mv tmp "$auml" &&
  90  git commit -m rename &&
  91  git checkout -f master
  92
  93'
  94
  95$test_unicode 'rename (silent unicode normalization)' '
  96
  97 git mv "$aumlcdiar" "$auml" &&
  98 git commit -m rename
  99
 100'
 101
 102$test_unicode 'merge (silent unicode normalization)' '
 103
 104 git reset --hard initial &&
 105 git merge topic
 106
 107'
 108
 109test_done