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