2009-05-06 16:33:34 +02:00
|
|
|
#!/bin/sh
|
2008-08-15 13:39:26 +02:00
|
|
|
#
|
|
|
|
# Copyright (c) Jim Meyering
|
|
|
|
#
|
2009-01-20 22:08:33 +01:00
|
|
|
test_description='diff honors config option, diff.suppressBlankEmpty'
|
2008-08-15 13:39:26 +02:00
|
|
|
|
2021-10-31 00:24:19 +02:00
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
2008-08-15 13:39:26 +02:00
|
|
|
. ./test-lib.sh
|
|
|
|
|
2018-05-21 04:01:40 +02:00
|
|
|
cat <<\EOF >expected ||
|
2008-08-15 13:39:26 +02:00
|
|
|
diff --git a/f b/f
|
|
|
|
index 5f6a263..8cb8bae 100644
|
|
|
|
--- a/f
|
|
|
|
+++ b/f
|
|
|
|
@@ -1,2 +1,2 @@
|
|
|
|
|
|
|
|
-x
|
|
|
|
+y
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
|
2018-05-21 04:01:39 +02:00
|
|
|
test_expect_success "$test_description" '
|
|
|
|
printf "\nx\n" > f &&
|
2018-05-21 04:01:40 +02:00
|
|
|
before=$(git hash-object f) &&
|
|
|
|
before=$(git rev-parse --short $before) &&
|
2018-05-21 04:01:39 +02:00
|
|
|
git add f &&
|
|
|
|
git commit -q -m. f &&
|
|
|
|
printf "\ny\n" > f &&
|
2018-05-21 04:01:40 +02:00
|
|
|
after=$(git hash-object f) &&
|
|
|
|
after=$(git rev-parse --short $after) &&
|
|
|
|
sed -e "s/^index .*/index $before..$after 100644/" expected >exp &&
|
2018-05-21 04:01:39 +02:00
|
|
|
git config --bool diff.suppressBlankEmpty true &&
|
|
|
|
git diff f > actual &&
|
|
|
|
test_cmp exp actual &&
|
|
|
|
perl -i.bak -p -e "s/^\$/ /" exp &&
|
|
|
|
git config --bool diff.suppressBlankEmpty false &&
|
|
|
|
git diff f > actual &&
|
|
|
|
test_cmp exp actual &&
|
|
|
|
git config --bool --unset diff.suppressBlankEmpty &&
|
|
|
|
git diff f > actual &&
|
|
|
|
test_cmp exp actual
|
|
|
|
'
|
2008-08-15 13:39:26 +02:00
|
|
|
|
|
|
|
test_done
|