]> git.ipfire.org Git - thirdparty/git.git/blob - t/t4029-diff-trailing-space.sh
The third batch
[thirdparty/git.git] / t / t4029-diff-trailing-space.sh
1 #!/bin/sh
2 #
3 # Copyright (c) Jim Meyering
4 #
5 test_description='diff honors config option, diff.suppressBlankEmpty'
6
7 TEST_PASSES_SANITIZE_LEAK=true
8 . ./test-lib.sh
9
10 cat <<\EOF >expected ||
11 diff --git a/f b/f
12 index 5f6a263..8cb8bae 100644
13 --- a/f
14 +++ b/f
15 @@ -1,2 +1,2 @@
16
17 -x
18 +y
19 EOF
20 exit 1
21
22 test_expect_success "$test_description" '
23 printf "\nx\n" > f &&
24 before=$(git hash-object f) &&
25 before=$(git rev-parse --short $before) &&
26 git add f &&
27 git commit -q -m. f &&
28 printf "\ny\n" > f &&
29 after=$(git hash-object f) &&
30 after=$(git rev-parse --short $after) &&
31 sed -e "s/^index .*/index $before..$after 100644/" expected >exp &&
32 git config --bool diff.suppressBlankEmpty true &&
33 git diff f > actual &&
34 test_cmp exp actual &&
35 perl -i.bak -p -e "s/^\$/ /" exp &&
36 git config --bool diff.suppressBlankEmpty false &&
37 git diff f > actual &&
38 test_cmp exp actual &&
39 git config --bool --unset diff.suppressBlankEmpty &&
40 git diff f > actual &&
41 test_cmp exp actual
42 '
43
44 test_done