Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t2006-checkout-index-basic.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t2006-checkout-index-basic.sh` 110 lines ยท 3195 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='basic checkout-index tests 4 ' 5 6 . ./test-lib.sh 7 8 test_expect_success 'checkout-index --gobbledegook' ' 9 test_expect_code 129 git checkout-index --gobbledegook 2>err && 10 test_grep "[Uu]sage" err 11 ' 12 13 test_expect_success 'checkout-index -h in broken repository' ' 14 mkdir broken && 15 ( 16 cd broken && 17 git init && 18 >.git/index && 19 git checkout-index -h >usage 2>&1 20 ) && 21 test_grep "[Uu]sage" broken/usage 22 ' 23 24 test_expect_success 'checkout-index does not crash with -h' ' 25 git checkout-index -h >usage && 26 test_grep "[Uu]sage: git checkout-index " usage && 27 nongit git checkout-index -h >usage && 28 test_grep "[Uu]sage: git checkout-index " usage 29 ' 30 31 test_expect_success 'checkout-index reports errors (cmdline)' ' 32 test_must_fail git checkout-index -- does-not-exist 2>stderr && 33 test_grep not.in.the.cache stderr 34 ' 35 36 test_expect_success 'checkout-index reports errors (stdin)' ' 37 echo does-not-exist | 38 test_must_fail git checkout-index --stdin 2>stderr && 39 test_grep not.in.the.cache stderr 40 ' 41 for mode in 'case' 'utf-8' 42 do 43 case "$mode" in 44 case) dir='A' symlink='a' mode_prereq='CASE_INSENSITIVE_FS' ;; 45 utf-8) 46 dir=$(printf "\141\314\210") symlink=$(printf "\303\244") 47 mode_prereq='UTF8_NFD_TO_NFC' ;; 48 esac 49 50 test_expect_success SYMLINKS,$mode_prereq \ 51 "checkout-index with $mode-collision don't write to the wrong place" ' 52 git init $mode-collision && 53 ( 54 cd $mode-collision && 55 mkdir target-dir && 56 57 empty_obj_hex=$(git hash-object -w --stdin objs <<-EOF && 61 100644 blob ${empty_obj_hex} ${dir}/x 62 100644 blob ${empty_obj_hex} ${dir}/y 63 100644 blob ${empty_obj_hex} ${dir}/z 64 120000 blob ${symlink_hex} ${symlink} 65 EOF 66 67 git update-index --index-info objs <<-EOF && 91 100644 $missing_blob file 92 120000 $missing_blob symlink 93 EOF 94 git update-index --index-info stderr && 97 test_grep "unable to read sha1 file of file ($missing_blob)" stderr && 98 test_grep "unable to read sha1 file of symlink ($missing_blob)" stderr 99 ' 100 101 test_expect_success 'checkout-index --temp correctly reports error for submodules' ' 102 git init sub && 103 test_commit -C sub file && 104 git submodule add ./sub && 105 git commit -m sub && 106 test_must_fail git checkout-index --temp sub 2>stderr && 107 test_grep "cannot create temporary submodule sub" stderr 108 ' 109 110 test_done