t / t0050-filesystem.shon commit Merge branch 'jc/diff-test-updates' into maint (bb8f6de)
   1#!/bin/sh
   2
   3test_description='Various filesystem issues'
   4
   5. ./test-lib.sh
   6
   7auml=$(printf '\303\244')
   8aumlcdiar=$(printf '\141\314\210')
   9
  10if test_have_prereq CASE_INSENSITIVE_FS
  11then
  12        say "will test on a case insensitive filesystem"
  13        test_case=test_expect_failure
  14else
  15        test_case=test_expect_success
  16fi
  17
  18if test_have_prereq UTF8_NFD_TO_NFC
  19then
  20        say "will test on a unicode corrupting filesystem"
  21        test_unicode=test_expect_failure
  22else
  23        test_unicode=test_expect_success
  24fi
  25
  26test_have_prereq SYMLINKS ||
  27        say "will test on a filesystem lacking symbolic links"
  28
  29if test_have_prereq CASE_INSENSITIVE_FS
  30then
  31test_expect_success "detection of case insensitive filesystem during repo init" '
  32        test $(git config --bool core.ignorecase) = true
  33'
  34else
  35test_expect_success "detection of case insensitive filesystem during repo init" '
  36        test_must_fail git config --bool core.ignorecase >/dev/null ||
  37        test $(git config --bool core.ignorecase) = false
  38'
  39fi
  40
  41if test_have_prereq SYMLINKS
  42then
  43test_expect_success "detection of filesystem w/o symlink support during repo init" '
  44        test_must_fail git config --bool core.symlinks ||
  45        test "$(git config --bool core.symlinks)" = true
  46'
  47else
  48test_expect_success "detection of filesystem w/o symlink support during repo init" '
  49        v=$(git config --bool core.symlinks) &&
  50        test "$v" = false
  51'
  52fi
  53
  54test_expect_success "setup case tests" '
  55        git config core.ignorecase true &&
  56        touch camelcase &&
  57        git add camelcase &&
  58        git commit -m "initial" &&
  59        git tag initial &&
  60        git checkout -b topic &&
  61        git mv camelcase tmp &&
  62        git mv tmp CamelCase &&
  63        git commit -m "rename" &&
  64        git checkout -f master
  65'
  66
  67test_expect_success 'rename (case change)' '
  68        git mv camelcase CamelCase &&
  69        git commit -m "rename"
  70'
  71
  72test_expect_success 'merge (case change)' '
  73        rm -f CamelCase &&
  74        rm -f camelcase &&
  75        git reset --hard initial &&
  76        git merge topic
  77'
  78
  79
  80
  81test_expect_failure CASE_INSENSITIVE_FS 'add (with different case)' '
  82        git reset --hard initial &&
  83        rm camelcase &&
  84        echo 1 >CamelCase &&
  85        git add CamelCase &&
  86        camel=$(git ls-files | grep -i camelcase) &&
  87        test $(echo "$camel" | wc -l) = 1 &&
  88        test "z$(git cat-file blob :$camel)" = z1
  89'
  90
  91test_expect_success "setup unicode normalization tests" '
  92        test_create_repo unicode &&
  93        cd unicode &&
  94        git config core.precomposeunicode false &&
  95        touch "$aumlcdiar" &&
  96        git add "$aumlcdiar" &&
  97        git commit -m initial &&
  98        git tag initial &&
  99        git checkout -b topic &&
 100        git mv $aumlcdiar tmp &&
 101        git mv tmp "$auml" &&
 102        git commit -m rename &&
 103        git checkout -f master
 104'
 105
 106$test_unicode 'rename (silent unicode normalization)' '
 107        git mv "$aumlcdiar" "$auml" &&
 108        git commit -m rename
 109'
 110
 111$test_unicode 'merge (silent unicode normalization)' '
 112        git reset --hard initial &&
 113        git merge topic
 114'
 115
 116test_done