Merge branch 'ar/submodule-add-config'
[git/debian.git] / t / lib-read-tree.sh
blobb95f4856061da723cbe36bd6955c552bee7a29aa
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.
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 "$@"
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 "$@"
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 "$@"
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 "$@"