From patchwork Fri Nov 16 11:03:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phillip Wood X-Patchwork-Id: 10685925 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2D772109C for ; Fri, 16 Nov 2018 11:04:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 183282D128 for ; Fri, 16 Nov 2018 11:04:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C29C2D16A; Fri, 16 Nov 2018 11:04:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 751442D128 for ; Fri, 16 Nov 2018 11:04:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389539AbeKPVQH (ORCPT ); Fri, 16 Nov 2018 16:16:07 -0500 Received: from smtp-out-5.talktalk.net ([62.24.135.69]:4700 "EHLO smtp-out-5.talktalk.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727544AbeKPVQH (ORCPT ); Fri, 16 Nov 2018 16:16:07 -0500 Received: from lindisfarne.localdomain ([92.22.32.73]) by smtp.talktalk.net with SMTP id NbuxgXotudJAeNbv4gYs20; Fri, 16 Nov 2018 11:04:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=talktalk.net; s=cmr1711; t=1542366254; bh=v4VOunfTLikFtF3lKeuaG8j1meNFiuVbF67pG1bgWGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To; b=NSt7gdgMkU21YC2makzJ3btzKrgaqt3s42eg3DNp57Aoz8+gVmpd37rGhwxXfBFqm bn1ZeGGFxAIB9Um4Ed2KguWjGUUCi8Pz+McYNNBTh7U1DBt3g/qeHNA0b0lsohxgYX Zlj5NHIQdndRer3qOXszCoV6HWJeh+all9TlBOoM= X-Originating-IP: [92.22.32.73] X-Spam: 0 X-OAuthority: v=2.3 cv=V8BTL9vi c=1 sm=1 tr=0 a=w3K0eKD2tyZHkEydg3BQCA==:117 a=w3K0eKD2tyZHkEydg3BQCA==:17 a=evINK-nbAAAA:8 a=jXCYYOxaiYF5wbv4ZvcA:9 a=s1rkbyRdG-LNbfjc:21 a=rbZOPNKEenb8vpLT:21 a=RfR_gqz1fSpA9VikTjo0:22 From: Phillip Wood To: Git Mailing List , Stefan Beller Cc: Phillip Wood Subject: [PATCH v1 4/9] diff --color-moved-ws: demonstrate false positives Date: Fri, 16 Nov 2018 11:03:51 +0000 Message-Id: <20181116110356.12311-5-phillip.wood@talktalk.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181116110356.12311-1-phillip.wood@talktalk.net> References: <20180924100604.32208-1-phillip.wood@talktalk.net> <20181116110356.12311-1-phillip.wood@talktalk.net> MIME-Version: 1.0 Reply-To: Phillip Wood X-CMAE-Envelope: MS4wfL7V19BxUQEBYag32sT2sGWRZKebsYdbnJXvS/cr8UoW3Swculn5o6u/gJA0q/seu5fIGW2Q7yfxiCwk+XWKfG+g3eiyB2dR8zA5iYlPOaMbz1JPuU2+ pves/nf+v3Efjt5lmBQ/lv823Bh58uB/LFj1Xz66VkZxTQo04dgRsMsZNooLwGe2LdQy6V+PMb9nT9eyct+MnXaQkmXAuy1LwvSLjZLil9p6lYqOx60sPjU3 TEFLjXWZtEnCpNqTeZe2xA== Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Phillip Wood 'diff --color-moved-ws=allow-indentation-change' can highlight lines that have internal whitespace changes rather than indentation changes. For example in commit 1a07e59c3e ("Update messages in preparation for i18n", 2018-07-21) the lines - die (_("must end with a color")); + die(_("must end with a color")); are highlighted as moved when they should not be. Modify an existing test to show the problem that will be fixed in the next commit. Signed-off-by: Phillip Wood --- t/t4015-diff-whitespace.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh index a9fb226c5a..eee81a1987 100755 --- a/t/t4015-diff-whitespace.sh +++ b/t/t4015-diff-whitespace.sh @@ -1809,7 +1809,7 @@ test_expect_success 'only move detection ignores white spaces' ' test_cmp expected actual ' -test_expect_success 'compare whitespace delta across moved blocks' ' +test_expect_failure 'compare whitespace delta across moved blocks' ' git reset --hard && q_to_tab <<-\EOF >text.txt && @@ -1827,6 +1827,7 @@ test_expect_success 'compare whitespace delta across moved blocks' ' QQQthat has similar lines QQQto previous blocks, but with different indent QQQYetQAnotherQoutlierQ + QLine with internal w h i t e s p a c e change EOF git add text.txt && @@ -1847,6 +1848,7 @@ test_expect_success 'compare whitespace delta across moved blocks' ' QQthat has similar lines QQto previous blocks, but with different indent QQYetQAnotherQoutlier + QLine with internal whitespace change EOF git diff --color --color-moved --color-moved-ws=allow-indentation-change >actual.raw && @@ -1856,7 +1858,7 @@ test_expect_success 'compare whitespace delta across moved blocks' ' diff --git a/text.txt b/text.txt --- a/text.txt +++ b/text.txt - @@ -1,14 +1,14 @@ + @@ -1,15 +1,15 @@ -QIndented -QText across -Qsome lines @@ -1871,6 +1873,7 @@ test_expect_success 'compare whitespace delta across moved blocks' ' -QQQthat has similar lines -QQQto previous blocks, but with different indent -QQQYetQAnotherQoutlierQ + -QLine with internal w h i t e s p a c e change +QQIndented +QQText across +QQsome lines @@ -1885,6 +1888,7 @@ test_expect_success 'compare whitespace delta across moved blocks' ' +QQthat has similar lines +QQto previous blocks, but with different indent +QQYetQAnotherQoutlier + +QLine with internal whitespace change EOF test_cmp expected actual