Merge branch 'jc/revision-dash-count-parsing'
[git.git] / t / t4040-whitespace-status.sh
blob3c728a3ebf9ce52e5c24c81525d5cb749cfb2957
1 #!/bin/sh
3 test_description='diff --exit-code with whitespace'
4 . ./test-lib.sh
6 test_expect_success setup '
7 mkdir a b &&
8 echo >c &&
9 echo >a/d &&
10 echo >b/e &&
11 git add . &&
12 test_tick &&
13 git commit -m initial &&
14 echo " " >a/d &&
15 test_tick &&
16 git commit -a -m second &&
17 echo " " >a/d &&
18 echo " " >b/e &&
19 git add a/d
22 test_expect_success 'diff-tree --exit-code' '
23 test_must_fail git diff --exit-code HEAD^ HEAD &&
24 test_must_fail git diff-tree --exit-code HEAD^ HEAD
27 test_expect_success 'diff-tree -b --exit-code' '
28 git diff -b --exit-code HEAD^ HEAD &&
29 git diff-tree -b -p --exit-code HEAD^ HEAD &&
30 git diff-tree -b --exit-code HEAD^ HEAD
33 test_expect_success 'diff-index --cached --exit-code' '
34 test_must_fail git diff --cached --exit-code HEAD &&
35 test_must_fail git diff-index --cached --exit-code HEAD
38 test_expect_success 'diff-index -b -p --cached --exit-code' '
39 git diff -b --cached --exit-code HEAD &&
40 git diff-index -b -p --cached --exit-code HEAD
43 test_expect_success 'diff-index --exit-code' '
44 test_must_fail git diff --exit-code HEAD &&
45 test_must_fail git diff-index --exit-code HEAD
48 test_expect_success 'diff-index -b -p --exit-code' '
49 git diff -b --exit-code HEAD &&
50 git diff-index -b -p --exit-code HEAD
53 test_expect_success 'diff-files --exit-code' '
54 test_must_fail git diff --exit-code &&
55 test_must_fail git diff-files --exit-code
58 test_expect_success 'diff-files -b -p --exit-code' '
59 git diff -b --exit-code &&
60 git diff-files -b -p --exit-code
63 test_expect_success 'diff-files --diff-filter --quiet' '
64 git reset --hard &&
65 rm a/d &&
66 echo x >>b/e &&
67 test_must_fail git diff-files --diff-filter=M --quiet
70 test_expect_success 'diff-tree --diff-filter --quiet' '
71 git commit -a -m "worktree state" &&
72 test_must_fail git diff-tree --diff-filter=M --quiet HEAD^ HEAD
75 test_done