From: Jeff King Date: Wed, 20 Aug 2008 22:20:48 GMT Subject: Re: diff --check is stupid about blank lines Message-ID: <20080820222048.GB8137@coredump.intra.peff.net> In-Reply-To: <7vskszr0it.fsf@gitster.siamese.dyndns.org> On Wed, Aug 20, 2008 at 11:42:34AM -0700, Junio C Hamano wrote: > 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