blob: 36e2f075c9f94286a05474b58e7600f2a9de2f20 [file] [log] [blame]
Nguyễn Thái Ngọc Duyc5ae7cb2009-05-07 00:33:34 +10001#!/bin/sh
Jim Meyeringa624eaa2008-08-15 13:39:26 +02002#
3# Copyright (c) Jim Meyering
4#
Johannes Schindelin950db872009-01-20 22:08:33 +01005test_description='diff honors config option, diff.suppressBlankEmpty'
Jim Meyeringa624eaa2008-08-15 13:39:26 +02006
7. ./test-lib.sh
8
9cat <<\EOF > exp ||
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
21test_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 &&
Johannes Schindelin950db872009-01-20 22:08:33 +010027 git config --bool diff.suppressBlankEmpty true &&
Jim Meyeringa624eaa2008-08-15 13:39:26 +020028 git diff f > actual &&
29 test_cmp exp actual &&
Junio C Hamano7096b642012-06-12 09:49:59 -070030 "$PERL_PATH" -i.bak -p -e "s/^\$/ /" exp &&
Johannes Schindelin950db872009-01-20 22:08:33 +010031 git config --bool diff.suppressBlankEmpty false &&
Jim Meyeringa624eaa2008-08-15 13:39:26 +020032 git diff f > actual &&
33 test_cmp exp actual &&
Johannes Schindelin950db872009-01-20 22:08:33 +010034 git config --bool --unset diff.suppressBlankEmpty &&
Jim Meyeringa624eaa2008-08-15 13:39:26 +020035 git diff f > actual &&
36 test_cmp exp actual
37 '
38
39test_done