Merge branch 'ds/reprepare-alternates-when-repreparing-packfiles'
[alt-git.git] / t / t4040-whitespace-status.sh
blobe70e020ae9349c378b4b922933668932e95acc8d
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 &&
32 git diff-tree -b --exit-code HEAD^ HEAD
35 test_expect_success 'diff-index --cached --exit-code' '
36 test_must_fail git diff --cached --exit-code HEAD &&
37 test_must_fail git diff-index --cached --exit-code HEAD
40 test_expect_success 'diff-index -b -p --cached --exit-code' '
41 git diff -b --cached --exit-code HEAD &&
42 git diff-index -b -p --cached --exit-code HEAD
45 test_expect_success 'diff-index --exit-code' '
46 test_must_fail git diff --exit-code HEAD &&
47 test_must_fail git diff-index --exit-code HEAD
50 test_expect_success 'diff-index -b -p --exit-code' '
51 git diff -b --exit-code HEAD &&
52 git diff-index -b -p --exit-code HEAD
55 test_expect_success 'diff-files --exit-code' '
56 test_must_fail git diff --exit-code &&
57 test_must_fail git diff-files --exit-code
60 test_expect_success 'diff-files -b -p --exit-code' '
61 git diff -b --exit-code &&
62 git diff-files -b -p --exit-code
65 test_expect_success 'diff-files --diff-filter --quiet' '
66 git reset --hard &&
67 rm a/d &&
68 echo x >>b/e &&
69 test_must_fail git diff-files --diff-filter=M --quiet
72 test_expect_success 'diff-tree --diff-filter --quiet' '
73 git commit -a -m "worktree state" &&
74 test_must_fail git diff-tree --diff-filter=M --quiet HEAD^ HEAD
77 test_done