3 test_description='basic checkout-index tests
8 test_expect_success 'checkout-index --gobbledegook' '
9 test_expect_code 129 git checkout-index --gobbledegook 2>err &&
10 test_i18ngrep "[Uu]sage" err
13 test_expect_success 'checkout-index -h in broken repository' '
19 test_expect_code 129 git checkout-index -h >usage 2>&1
21 test_i18ngrep "[Uu]sage" broken/usage
24 for mode in 'case' 'utf-8'
27 case) dir='A' symlink='a' mode_prereq='CASE_INSENSITIVE_FS' ;;
29 dir=$(printf "\141\314\210") symlink=$(printf "\303\244")
30 mode_prereq='UTF8_NFD_TO_NFC' ;;
33 test_expect_success SYMLINKS,$mode_prereq \
34 "checkout-index with $mode-collision don't write to the wrong place" '
35 git init $mode-collision &&
40 empty_obj_hex=$(git hash-object -w --stdin </dev/null) &&
41 symlink_hex=$(printf "%s" "$PWD/target-dir" | git hash-object -w --stdin) &&
44 100644 blob ${empty_obj_hex} ${dir}/x
45 100644 blob ${empty_obj_hex} ${dir}/y
46 100644 blob ${empty_obj_hex} ${dir}/z
47 120000 blob ${symlink_hex} ${symlink}
50 git update-index --index-info <objs &&
52 # Note: the order is important here to exercise the
53 # case where the file at ${dir} has its type changed by
54 # the time Git tries to check out ${dir}/z.
56 # Also, we use core.precomposeUnicode=false because we
57 # want Git to treat the UTF-8 paths transparently on
58 # Mac OS, matching what is in the index.
60 git -c core.precomposeUnicode=false checkout-index -f \
61 ${dir}/x ${dir}/y ${symlink} ${dir}/z &&
63 # Should not create ${dir}/z at ${symlink}/z
64 test_path_is_missing target-dir/z