Re: diff --check is stupid about blank lines
On Wed, Aug 20, 2008 at 11:42:34AM -0700, Junio C Hamano wrote:
Show 6 quoted lines
> Ahhh, what idiot wrote the logic for checking trailing blank lines in
> checkdiff_consume().
>
> It does not ask for any context lines. Sheesh.
>
> This should fix it.
Ah, that was much easier than I expected. ;)
Maybe this should be squashed in?
---
diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index 6110566..974efd0 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -341,4 +341,13 @@ test_expect_success 'checkdiff detects trailing blank lines' '
git diff --check | grep "ends with blank"
'
+test_expect_success 'checkdiff does not mistake trailing blank lines in hunk' '
+ echo content >x &&
+ git add x &&
+ echo "" >x &&
+ echo content >>x &&
+ git diff --check >out &&
+ ! grep "ends with blank" out
+'
+
test_done