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/lib-read-tree.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 / lib-read-tree.sh` 41 lines ยท 1257 bytes Raw Blame History 1 # Helper functions to check if read-tree would succeed/fail as expected with 2 # and without the dry-run option. They also test that the dry-run does not 3 # write the index and that together with -u it doesn't touch the work tree. 4 # 5 read_tree_must_succeed () { 6 git ls-files -s >pre-dry-run && 7 git read-tree -n "$@" && 8 git ls-files -s >post-dry-run && 9 test_cmp pre-dry-run post-dry-run && 10 git read-tree "$@" 11 } 12 13 read_tree_must_fail () { 14 git ls-files -s >pre-dry-run && 15 test_must_fail git read-tree -n "$@" && 16 git ls-files -s >post-dry-run && 17 test_cmp pre-dry-run post-dry-run && 18 test_must_fail git read-tree "$@" 19 } 20 21 read_tree_u_must_succeed () { 22 git ls-files -s >pre-dry-run && 23 git diff-files -p >pre-dry-run-wt && 24 git read-tree -n "$@" && 25 git ls-files -s >post-dry-run && 26 git diff-files -p >post-dry-run-wt && 27 test_cmp pre-dry-run post-dry-run && 28 test_cmp pre-dry-run-wt post-dry-run-wt && 29 git read-tree "$@" 30 } 31 32 read_tree_u_must_fail () { 33 git ls-files -s >pre-dry-run && 34 git diff-files -p >pre-dry-run-wt && 35 test_must_fail git read-tree -n "$@" && 36 git ls-files -s >post-dry-run && 37 git diff-files -p >post-dry-run-wt && 38 test_cmp pre-dry-run post-dry-run && 39 test_cmp pre-dry-run-wt post-dry-run-wt && 40 test_must_fail git read-tree "$@" 41 }