]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4029-diff-trailing-space.sh
Merge branch 'js/test-initial-branch-override-cleanup'
[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 6
16d4bd4f 7TEST_PASSES_SANITIZE_LEAK=true
a624eaa7
JM
8. ./test-lib.sh
9
b55ee572 10cat <<\EOF >expected ||
a624eaa7
JM
11diff --git a/f b/f
12index 5f6a263..8cb8bae 100644
13--- a/f
14+++ b/f
15@@ -1,2 +1,2 @@
16
17-x
18+y
19EOF
20exit 1
21
7022ba33 22test_expect_success "$test_description" '
23 printf "\nx\n" > f &&
b55ee572 24 before=$(git hash-object f) &&
25 before=$(git rev-parse --short $before) &&
7022ba33 26 git add f &&
27 git commit -q -m. f &&
28 printf "\ny\n" > f &&
b55ee572 29 after=$(git hash-object f) &&
30 after=$(git rev-parse --short $after) &&
31 sed -e "s/^index .*/index $before..$after 100644/" expected >exp &&
7022ba33 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'
a624eaa7
JM
43
44test_done