Merge branch 'kz/merge-fail-early-upon-refresh-failure'
[git.git] / t / t4040-whitespace-status.sh
blobeec3d73dc2b475be7185d9d1dc8733bf391a868b
1 #!/bin/sh
3 test_description='diff --exit-code with whitespace'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success setup '
9 mkdir a b &&
10 echo >c &&
11 echo >a/d &&
12 echo >b/e &&
13 git add . &&
14 test_tick &&
15 git commit -m initial &&
16 echo " " >a/d &&
17 test_tick &&
18 git commit -a -m second &&
19 echo " " >a/d &&
20 echo " " >b/e &&
21 git add a/d
24 test_expect_success 'diff-tree --exit-code' '
25 test_must_fail git diff --exit-code HEAD^ HEAD &&
26 test_must_fail git diff-tree --exit-code HEAD^ HEAD
29 test_expect_success 'diff-tree -b --exit-code' '
30 git diff -b --exit-code HEAD^ HEAD &&
31 git diff-tree -b -p --exit-code HEAD^ HEAD
34 test_expect_success 'diff-index --cached --exit-code' '
35 test_must_fail git diff --cached --exit-code HEAD &&
36 test_must_fail git diff-index --cached --exit-code HEAD
39 test_expect_success 'diff-index -b -p --cached --exit-code' '
40 git diff -b --cached --exit-code HEAD &&
41 git diff-index -b -p --cached --exit-code HEAD
44 test_expect_success 'diff-index --exit-code' '
45 test_must_fail git diff --exit-code HEAD &&
46 test_must_fail git diff-index --exit-code HEAD
49 test_expect_success 'diff-index -b -p --exit-code' '
50 git diff -b --exit-code HEAD &&
51 git diff-index -b -p --exit-code HEAD
54 test_expect_success 'diff-files --exit-code' '
55 test_must_fail git diff --exit-code &&
56 test_must_fail git diff-files --exit-code
59 test_expect_success 'diff-files -b -p --exit-code' '
60 git diff -b --exit-code &&
61 git diff-files -b -p --exit-code
64 test_expect_success 'diff-files --diff-filter --quiet' '
65 git reset --hard &&
66 rm a/d &&
67 echo x >>b/e &&
68 test_must_fail git diff-files --diff-filter=M --quiet
71 test_expect_success 'diff-tree --diff-filter --quiet' '
72 git commit -a -m "worktree state" &&
73 test_must_fail git diff-tree --diff-filter=M --quiet HEAD^ HEAD
76 test_done