Merge branch 'bg/apply-fix-blank-at-eof'
[alt-git.git] / t / t4029-diff-trailing-space.sh
blob3ccc237a8d4443bfc8763fbb9cb51033f846b0e8
1 #!/bin/sh
3 # Copyright (c) Jim Meyering
5 test_description='diff honors config option, diff.suppressBlankEmpty'
7 . ./test-lib.sh
9 cat <<\EOF > exp ||
10 diff --git a/f b/f
11 index 5f6a263..8cb8bae 100644
12 --- a/f
13 +++ b/f
14 @@ -1,2 +1,2 @@
18 EOF
19 exit 1
21 test_expect_success \
22 "$test_description" \
23 'printf "\nx\n" > f &&
24 git add f &&
25 git commit -q -m. f &&
26 printf "\ny\n" > f &&
27 git config --bool diff.suppressBlankEmpty true &&
28 git diff f > actual &&
29 test_cmp exp actual &&
30 perl -i.bak -p -e "s/^\$/ /" exp &&
31 git config --bool diff.suppressBlankEmpty false &&
32 git diff f > actual &&
33 test_cmp exp actual &&
34 git config --bool --unset diff.suppressBlankEmpty &&
35 git diff f > actual &&
36 test_cmp exp actual
39 test_done