From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-5.9 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id EBEB520756 for ; Fri, 13 Jan 2017 18:20:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750894AbdAMSUJ (ORCPT ); Fri, 13 Jan 2017 13:20:09 -0500 Received: from mout.web.de ([212.227.17.11]:54814 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750757AbdAMSUJ (ORCPT ); Fri, 13 Jan 2017 13:20:09 -0500 Received: from [192.168.178.36] ([79.213.118.247]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MGicf-1cEeCX1FfF-00DWSV; Fri, 13 Jan 2017 19:19:52 +0100 Subject: Re: [PATCH 2/3] xdiff: -W: include immediately preceding non-empty lines in context To: Vegard Nossum , Junio C Hamano , git@vger.kernel.org References: <1484324112-17773-1-git-send-email-vegard.nossum@oracle.com> <1484324112-17773-2-git-send-email-vegard.nossum@oracle.com> From: =?UTF-8?Q?Ren=c3=a9_Scharfe?= Message-ID: Date: Fri, 13 Jan 2017 19:19:48 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <1484324112-17773-2-git-send-email-vegard.nossum@oracle.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X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CXSfM3S5G+bI0Ml2NxSprkaZ U1VuEWI Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Am 13.01.2017 um 17:15 schrieb Vegard Nossum: > When using -W to include the whole function in the diff context, you > are typically doing this to be able to review the change in its entirety > within the context of the function. It is therefore almost always > desirable to include any comments that immediately precede the function. > > This also the fixes the case for C where the declaration is split across > multiple lines (where the first line of the declaration would not be > included in the output), e.g.: > > void > dummy(void) > { > ... > } > That's true, but I'm not sure "non-empty line before function line" is good enough a definition for desirable lines. It wouldn't work for people who don't believe in empty lines. Or for those that put a blank line between comment and function. (I have an opinion on such habits, but git diff should probably stay neutral.) And that's just for C code; I have no idea how this heuristic would hold up for other file types like HTML. We can identify function lines with arbitrary precision (with a xfuncname regex, if needed), but there is no accurate way to classify lines as comments, or as the end of functions. Adding optional regexes for single- and multi-line comments would help, at least for C. René