Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-08-15 15:39:26 +0400
committerJunio C Hamano <gitster@pobox.com>2008-08-20 05:09:37 +0400
commita624eaa7820f4f9814e41e911c665a0aba2fce34 (patch)
tree315d6c0ea6c2e4bb2b2f2de40a1468c58825a0e4 /t/t4029-diff-trailing-space.sh
parentc6670b348cb19c74a6d7f6943df4871eb0d8295f (diff)
add boolean diff.suppress-blank-empty config option
GNU diff's --suppress-blank-empty option makes it so that diff no longer outputs trailing white space unless the input data has it. With this option, empty context lines are now empty also in diff -u output. Before, they would have a single trailing space. * diff.c (diff_suppress_blank_empty): New global. (git_diff_basic_config): Set it. (fn_out_consume): Honor it. * t/t4029-diff-trailing-space.sh: New file. * Documentation/config.txt: Document it. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4029-diff-trailing-space.sh')
-rwxr-xr-xt/t4029-diff-trailing-space.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/t/t4029-diff-trailing-space.sh b/t/t4029-diff-trailing-space.sh
new file mode 100755
index 0000000000..4ca65e0332
--- /dev/null
+++ b/t/t4029-diff-trailing-space.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+#
+# Copyright (c) Jim Meyering
+#
+test_description='diff honors config option, diff.suppress-blank-empty'
+
+. ./test-lib.sh
+
+cat <<\EOF > exp ||
+diff --git a/f b/f
+index 5f6a263..8cb8bae 100644
+--- a/f
++++ b/f
+@@ -1,2 +1,2 @@
+
+-x
++y
+EOF
+exit 1
+
+test_expect_success \
+ "$test_description" \
+ 'printf "\nx\n" > f &&
+ git add f &&
+ git commit -q -m. f &&
+ printf "\ny\n" > f &&
+ git config --bool diff.suppress-blank-empty true &&
+ git diff f > actual &&
+ test_cmp exp actual &&
+ perl -i.bak -p -e "s/^\$/ /" exp &&
+ git config --bool diff.suppress-blank-empty false &&
+ git diff f > actual &&
+ test_cmp exp actual &&
+ git config --bool --unset diff.suppress-blank-empty &&
+ git diff f > actual &&
+ test_cmp exp actual
+ '
+
+test_done