From patchwork Fri Nov 23 11:16:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phillip Wood X-Patchwork-Id: 10695589 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 2333E13AD for ; Fri, 23 Nov 2018 11:17:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13C422C866 for ; Fri, 23 Nov 2018 11:17:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 089762C867; Fri, 23 Nov 2018 11:17:19 +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 9266A2C85C for ; Fri, 23 Nov 2018 11:17:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503653AbeKWWBH (ORCPT ); Fri, 23 Nov 2018 17:01:07 -0500 Received: from smtp-out-1.talktalk.net ([62.24.135.65]:17855 "EHLO smtp-out-1.talktalk.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730669AbeKWWBG (ORCPT ); Fri, 23 Nov 2018 17:01:06 -0500 Received: from lindisfarne.localdomain ([92.22.32.73]) by smtp.talktalk.net with SMTP id Q9SMg52vNwhzSQ9SUg6d24; Fri, 23 Nov 2018 11:17:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=talktalk.net; s=cmr1711; t=1542971834; bh=z9oX6mxY5hZK7Y2LnqBmzbtmAs2p3+nqqfKICwWGNPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To; b=EGmKVRSCPIVPf6mx0SFqXbn9f3odRcxi8gyjUHHO0JeVJnTZWu/9ZX1HyS6LXqC82 D4vMerqGj46oPQFd3G0Q0sZWbyf2ZlQaeD48v0GCrjTXBUJRu/zI55yMpmqqWJTHG/ NOIeWxF/EUeaP3vedFOP4rholFClIbkWZUDhaBXc= X-Originating-IP: [92.22.32.73] X-Spam: 0 X-OAuthority: v=2.3 cv=e8Iot5h/ 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 , Junio C Hamano Cc: Phillip Wood Subject: [PATCH v2 4/9] diff --color-moved-ws: demonstrate false positives Date: Fri, 23 Nov 2018 11:16:53 +0000 Message-Id: <20181123111658.30342-5-phillip.wood@talktalk.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181123111658.30342-1-phillip.wood@talktalk.net> References: <20180924100604.32208-1-phillip.wood@talktalk.net> <20181123111658.30342-1-phillip.wood@talktalk.net> MIME-Version: 1.0 Reply-To: Phillip Wood X-CMAE-Envelope: MS4wfL5VdPov7uGQMRUdM8eUhpqyUM5U1yv0VtIWx6/gBhCEX4Nx5bgXaHrra07C5LPbn0sOCVvY8HLWtVnW4XDVcv3cgMLbD1NTQ/8PE5RPtPzXHKFR+UkF /YEjMvVSAHi2ftVdxCvjCbXfsKwvHCmgLPMq6xePATB7tae2uH2I4QWkIP+Sv/V8hy+dwy9RcHuyEOowEOCr5ozCxJdogP242lzf6Cx8tIFa9tpy1zDk8HDs HSCmLOma6PzjSB4AAeeg0v8RWdShkbzLw5JdgqkxyBvXtlJO2vgRnTiiCF4HNhPa 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