aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-09-04 00:41:15 -0700
committerJunio C Hamano <gitster@pobox.com>2009-09-04 11:50:27 -0700
commit690ed8436326484fe7e3f4deac4cffd780c7d630 (patch)
treeb6119e4decaeeeb8aad175dabf40e09dfe9ec582 /t
parent467babf8d059caee9587567452fc8b46505b4e67 (diff)
downloadgit-690ed8436326484fe7e3f4deac4cffd780c7d630.tar.gz
git-690ed8436326484fe7e3f4deac4cffd780c7d630.tar.xz
diff --color: color blank-at-eof
Since the coloring logic processed the patch output one line at a time, we couldn't easily color code the new blank lines at the end of file. Reuse the adds_blank_at_eof() function to find where the runs of such blank lines start, keep track of the line number in the preimage while processing the patch output one line at a time, and paint the new blank lines that appear after that line to implement this. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t4019-diff-wserror.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/t/t4019-diff-wserror.sh b/t/t4019-diff-wserror.sh
index 1517fff9c..1e75f1a11 100755
--- a/t/t4019-diff-wserror.sh
+++ b/t/t4019-diff-wserror.sh
@@ -190,4 +190,13 @@ test_expect_success 'do not color trailing cr in context' '
'
+test_expect_success 'color new trailing blank lines' '
+ { echo a; echo b; echo; echo; } >x &&
+ git add x &&
+ { echo a; echo; echo; echo; echo; } >x &&
+ git diff --color x >output &&
+ cnt=$(grep "${blue_grep}" output | wc -l) &&
+ test $cnt = 2
+'
+
test_done