t / t0050-filesystem.shon commit clone: use --progress to force progress reporting (5a518ad)
   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=
  11unibad=
  12no_symlinks=
  13test_expect_success 'see what we expect' '
  14
  15        test_case=test_expect_success
  16        test_unicode=test_expect_success
  17        mkdir junk &&
  18        echo good >junk/CamelCase &&
  19        echo bad >junk/camelcase &&
  20        if test "$(cat junk/CamelCase)" != good
  21        then
  22                test_case=test_expect_failure
  23                case_insensitive=t
  24        fi &&
  25        rm -fr junk &&
  26        mkdir junk &&
  27        >junk/"$auml" &&
  28        case "$(cd junk && echo *)" in
  29        "$aumlcdiar")
  30                test_unicode=test_expect_failure
  31                unibad=t
  32                ;;
  33        *)      ;;
  34        esac &&
  35        rm -fr junk &&
  36        {
  37                ln -s x y 2> /dev/null &&
  38                test -h y 2> /dev/null ||
  39                no_symlinks=1
  40                rm -f y
  41        }
  42'
  43
  44test "$case_insensitive" &&
  45        say "will test on a case insensitive filesystem"
  46test "$unibad" &&
  47        say "will test on a unicode corrupting filesystem"
  48test "$no_symlinks" &&
  49        say "will test on a filesystem lacking symbolic links"
  50
  51if test "$case_insensitive"
  52then
  53test_expect_success "detection of case insensitive filesystem during repo init" '
  54
  55        test $(git config --bool core.ignorecase) = true
  56'
  57else
  58test_expect_success "detection of case insensitive filesystem during repo init" '
  59
  60        test_must_fail git config --bool core.ignorecase >/dev/null ||
  61        test $(git config --bool core.ignorecase) = false
  62'
  63fi
  64
  65if test "$no_symlinks"
  66then
  67test_expect_success "detection of filesystem w/o symlink support during repo init" '
  68
  69        v=$(git config --bool core.symlinks) &&
  70        test "$v" = false
  71'
  72else
  73test_expect_success "detection of filesystem w/o symlink support during repo init" '
  74
  75        test_must_fail git config --bool core.symlinks ||
  76        test "$(git config --bool core.symlinks)" = true
  77'
  78fi
  79
  80test_expect_success "setup case tests" '
  81
  82        git config core.ignorecase true &&
  83        touch camelcase &&
  84        git add camelcase &&
  85        git commit -m "initial" &&
  86        git tag initial &&
  87        git checkout -b topic &&
  88        git mv camelcase tmp &&
  89        git mv tmp CamelCase &&
  90        git commit -m "rename" &&
  91        git checkout -f master
  92
  93'
  94
  95$test_case 'rename (case change)' '
  96
  97        git mv camelcase CamelCase &&
  98        git commit -m "rename"
  99
 100'
 101
 102$test_case 'merge (case change)' '
 103
 104        rm -f CamelCase &&
 105        rm -f camelcase &&
 106        git reset --hard initial &&
 107        git merge topic
 108
 109'
 110
 111$test_case 'add (with different case)' '
 112
 113        git reset --hard initial &&
 114        rm camelcase &&
 115        echo 1 >CamelCase &&
 116        git add CamelCase &&
 117        test $(git ls-files | grep -i camelcase | wc -l) = 1
 118
 119'
 120
 121test_expect_success "setup unicode normalization tests" '
 122
 123  test_create_repo unicode &&
 124  cd unicode &&
 125  touch "$aumlcdiar" &&
 126  git add "$aumlcdiar" &&
 127  git commit -m initial
 128  git tag initial &&
 129  git checkout -b topic &&
 130  git mv $aumlcdiar tmp &&
 131  git mv tmp "$auml" &&
 132  git commit -m rename &&
 133  git checkout -f master
 134
 135'
 136
 137$test_unicode 'rename (silent unicode normalization)' '
 138
 139 git mv "$aumlcdiar" "$auml" &&
 140 git commit -m rename
 141
 142'
 143
 144$test_unicode 'merge (silent unicode normalization)' '
 145
 146 git reset --hard initial &&
 147 git merge topic
 148
 149'
 150
 151test_done