From patchwork Wed Oct 28 12:47:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Blain X-Patchwork-Id: 11865127 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71F5BC4363A for ; Thu, 29 Oct 2020 02:45:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A9CF2076A for ; Thu, 29 Oct 2020 02:45:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Mr9TXXpN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726086AbgJ1Vda (ORCPT ); Wed, 28 Oct 2020 17:33:30 -0400 Received: from mail-wm1-f41.google.com ([209.85.128.41]:36578 "EHLO mail-wm1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725905AbgJ1VdL (ORCPT ); Wed, 28 Oct 2020 17:33:11 -0400 Received: by mail-wm1-f41.google.com with SMTP id e2so651334wme.1 for ; Wed, 28 Oct 2020 14:33:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=p88YtccjQTKr5b0SZ3vpbltcnM/DGEuc3pmsjwT30wE=; b=Mr9TXXpNJOuHv7kT0scr7l3Llak7KVOOk3N9KCepPlsPEn0jnW506oz3O4n9en5NzX jdWZSKaO0x3pEDO3VwJn0Iyjq/4NTKRa9RcojfgDBaOpOZ9TTBUGF0a0LtmhJkkiofe0 kn+e9WVsM6EkK+mrrVnKLgfGV7KfGUe+f724p/V8l5+7qqu8uzgQtNYsyq1gGO2GU8ZB 94S5fE9uwHOkCewzinZvaX+cl0oqkO7AqaWCcrxNccvWbdtgTbi2vGUIS2ZpMZwcjWqH v0++1FCTFPi4pnHcG8EyxIh5d0nPbRYxtjlcRkgCKOnAO9ZVs9LI3m9ouwxdpXTpsted 4q1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=p88YtccjQTKr5b0SZ3vpbltcnM/DGEuc3pmsjwT30wE=; b=Hao/PfuA0++D9v6pHTwFlBK+gpQP8pG5ghg5XSSmh0bdHBLYfkoqRGk3MTl8NYEfA8 o/FpaiChjSamVtHqlA6taWkd23HuYGgDVTf/eD/WC0t6pLKj32nRPY9QcaWf7bCr8wcp 90v75FE/6s4jQR6Dag5u8vGwUhHz0Uk4BFaAJJn0q810sAQGrReyRfv4NOO6wojWczLc 6haDsepVzmGzoynAoR9R0r5MoEuv1JiMBpDP7xqKTWn6Bv0m5RsZMtdjAu1q/0e22ZvL eGcNodCKkjCYTtQCATFhhlN7Ai0yn9w5YgaFz6nyD9rNLfGcbqRM1aJoqS/4NYlP2PFL ai/g== X-Gm-Message-State: AOAM533hV5Ha0anOjSmVVe2ghmnHqiJNhyx+NVJbsO82DiA5nQ8dnMBB C5L+uJaTB2ntmY2vv2wvix6chUW4YT0= X-Google-Smtp-Source: ABdhPJzhrVSqhPKDP9SfsYWisilcE1FTDWGLAazl6kPBS+9vsUDVv2/wgIfMjksFp/xXJt8R8Eg5nQ== X-Received: by 2002:a05:600c:4114:: with SMTP id j20mr4871921wmi.62.1603889273066; Wed, 28 Oct 2020 05:47:53 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m12sm6831430wrs.92.2020.10.28.05.47.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 05:47:52 -0700 (PDT) Message-Id: <96f6f95abcbd79d432073cb294ba12b71300580f.1603889270.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 28 Oct 2020 12:47:45 +0000 Subject: [PATCH 1/6] doc: log, gitk: move '-L' description to 'line-range-options.txt' Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Thomas Rast , Eric Sunshine , =?utf-8?b?UmVuw6k=?= Scharfe , Philippe Blain , Philippe Blain Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Philippe Blain From: Philippe Blain The description of the '-L' option for `git log` and `gitk` is the same, but is repeated in both 'git-log.txt' and 'gitk.txt'. Remove the duplication by creating a new file, 'line-range-options.txt', and include it in both files. Signed-off-by: Philippe Blain --- Documentation/git-log.txt | 16 ++-------------- Documentation/gitk.txt | 21 ++------------------- Documentation/line-range-options.txt | 27 +++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 33 deletions(-) create mode 100644 Documentation/line-range-options.txt diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt index 2b8ac5ff88..631dfff77c 100644 --- a/Documentation/git-log.txt +++ b/Documentation/git-log.txt @@ -77,20 +77,8 @@ produced by `--stat`, etc. Intended to speed up tools that read log messages from `git log` output by allowing them to allocate space in advance. --L ,::: --L :::: - Trace the evolution of the line range given by "," - (or the function name regex ) within the . You may - not give any pathspec limiters. This is currently limited to - a walk starting from a single revision, i.e., you may only - give zero or one positive revision arguments, and - and (or ) must exist in the starting revision. - You can specify this option more than once. Implies `--patch`. - Patch output can be suppressed using `--no-patch`, but other diff formats - (namely `--raw`, `--numstat`, `--shortstat`, `--dirstat`, `--summary`, - `--name-only`, `--name-status`, `--check`) are not currently implemented. -+ -include::line-range-format.txt[] +:git-log: 1 +include::line-range-options.txt[] :: Show only commits in the specified revision range. When no diff --git a/Documentation/gitk.txt b/Documentation/gitk.txt index c653ebb6a8..761b764c18 100644 --- a/Documentation/gitk.txt +++ b/Documentation/gitk.txt @@ -98,25 +98,8 @@ linkgit:git-rev-list[1] for a complete list. (See "History simplification" in linkgit:git-log[1] for a more detailed explanation.) --L,::: --L:::: - - Trace the evolution of the line range given by "," - (or the function name regex ) within the . You may - not give any pathspec limiters. This is currently limited to - a walk starting from a single revision, i.e., you may only - give zero or one positive revision arguments, and - and (or ) must exist in the starting revision. - You can specify this option more than once. Implies `--patch`. - Patch output can be suppressed using `--no-patch`, but other diff formats - (namely `--raw`, `--numstat`, `--shortstat`, `--dirstat`, `--summary`, - `--name-only`, `--name-status`, `--check`) are not currently implemented. -+ -*Note:* gitk (unlike linkgit:git-log[1]) currently only understands -this option if you specify it "glued together" with its argument. Do -*not* put a space after `-L`. -+ -include::line-range-format.txt[] +:gitk: 1 +include::line-range-options.txt[] :: diff --git a/Documentation/line-range-options.txt b/Documentation/line-range-options.txt new file mode 100644 index 0000000000..9e3d98d44f --- /dev/null +++ b/Documentation/line-range-options.txt @@ -0,0 +1,27 @@ +ifdef::git-log[] +-L ,::: +-L :::: +endif::git-log[] +ifdef::gitk[] +-L,::: +-L:::: +endif::gitk[] + + Trace the evolution of the line range given by "," + (or the function name regex ) within the . You may + not give any pathspec limiters. This is currently limited to + a walk starting from a single revision, i.e., you may only + give zero or one positive revision arguments, and + and (or ) must exist in the starting revision. + You can specify this option more than once. Implies `--patch`. + Patch output can be suppressed using `--no-patch`, but other diff formats + (namely `--raw`, `--numstat`, `--shortstat`, `--dirstat`, `--summary`, + `--name-only`, `--name-status`, `--check`) are not currently implemented. ++ +ifdef::gitk[] +*Note:* gitk (unlike linkgit:git-log[1]) currently only understands +this option if you specify it "glued together" with its argument. Do +*not* put a space after `-L`. +endif::gitk[] ++ +include::line-range-format.txt[] From patchwork Wed Oct 28 12:47:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Blain X-Patchwork-Id: 11864953 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D8CAC4363A for ; Thu, 29 Oct 2020 02:05:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A836220878 for ; Thu, 29 Oct 2020 02:05:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="R7u8uOJE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388174AbgJ2CEn (ORCPT ); Wed, 28 Oct 2020 22:04:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726272AbgJ1VjG (ORCPT ); Wed, 28 Oct 2020 17:39:06 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCE78C0613CF for ; Wed, 28 Oct 2020 14:39:05 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id 13so655366wmf.0 for ; Wed, 28 Oct 2020 14:39:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=bkG1AbO7CDoqXplFXj4nxwr1mT3OVxp12LeC4oSNcYU=; b=R7u8uOJEU94/dOjT6cLQw1wdx+EQJ8LaUGgubI+aTXnP+4S/8B7y2Jt7WZtCVBWt3m mCaww/C7M7VZcHqgcIHbBMd5Wou96hYGw2CPavqnSZGwuHOjGWNIOcRcfX6wdgPeM8Vf KDEoiCZleNW66ONMU5BEAo0e5EWxsu5BEUY1hrtySfNYEwkq+lEMNI4YT3XtdnccFPxf zEyVw/taBmi7JIIYTGyh1PxL2Nxy767OV8si5Wk+sApVFwHRDTUhSHb+qTKAs6QxsPuK pNQj/SSib6Lrzpd2sfrP3bRE25US/c/1gE6cBKBz9qt8De5nE4sqwMXa1IUcx9h7jt6e jv6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=bkG1AbO7CDoqXplFXj4nxwr1mT3OVxp12LeC4oSNcYU=; b=gx2JAApKxTU+c2Bfhst71ePPAeXqaBfNiiyZY3C0LGsHTDRuICUcCzw5eVQqdV4y1+ 7rCQ2TzlX7aoK5f26n/4VHji13lr7LLhmSfD4bWNu3JGa43z838rk1uTxn02ZkLAqVNN 74RrCnGOSHvL/xxhU7OtWYGTvYgE6UmWRYhwMHNj9YsXf2Sjt42RFQ7+vprClpTEBXvv 9c6+w5HgrxEsZtwhQtLj22C0hAvgTrTcqp5rN8bO9DsM76o5X80IarBgmf0p9bPwj/0g cDjb47uB9LBMbL8FLVIGynlCWdL+2LAjYFGJaJctEiXKFC2AQrcLgf4qRr5yiXy617Iz Qplg== X-Gm-Message-State: AOAM5312sXTg+D83le0a3Bl3Eky4RPLb6hmZKZ4dVKuxnfR7r3KkL+Vx S3yuApw2SKdUZ8tDEYOq3+Vn6yiFA/M= X-Google-Smtp-Source: ABdhPJweblCKIqqecDcHVRWVB7WLW5UOik0IHToTayX9hgIqVA9+5CLhC8h4w/GsGOrPQvjeTodEFg== X-Received: by 2002:a1c:7708:: with SMTP id t8mr7968636wmi.6.1603889273990; Wed, 28 Oct 2020 05:47:53 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id 4sm6796536wrn.48.2020.10.28.05.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 05:47:53 -0700 (PDT) Message-Id: <7d3fc0a503b160ea15363a4465af4647bce6a30b.1603889270.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 28 Oct 2020 12:47:46 +0000 Subject: [PATCH 2/6] doc: line-range: improve formatting Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Thomas Rast , Eric Sunshine , =?utf-8?b?UmVuw6k=?= Scharfe , Philippe Blain , Philippe Blain Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Philippe Blain From: Philippe Blain Improve the formatting of the description of the line-range option '-L' for `git log`, `gitk` and `git blame`: - Use bold for , and - Use backticks for literals Signed-off-by: Philippe Blain --- Documentation/blame-options.txt | 4 ++-- Documentation/line-range-format.txt | 24 ++++++++++++------------ Documentation/line-range-options.txt | 6 +++--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Documentation/blame-options.txt b/Documentation/blame-options.txt index 88750af7ae..48bf0eeec5 100644 --- a/Documentation/blame-options.txt +++ b/Documentation/blame-options.txt @@ -14,8 +14,8 @@ Annotate only the given line range. May be specified multiple times. Overlapping ranges are allowed. + - and are optional. ``-L '' or ``-L ,'' spans from - to end of file. ``-L ,'' spans from start of file to . +'' and '' are optional. `-L ` or `-L ,` spans from +'' to end of file. `-L ,` spans from start of file to ''. + include::line-range-format.txt[] diff --git a/Documentation/line-range-format.txt b/Documentation/line-range-format.txt index 829676ff98..6ee159b683 100644 --- a/Documentation/line-range-format.txt +++ b/Documentation/line-range-format.txt @@ -1,30 +1,30 @@ - and can take one of these forms: +'' and '' can take one of these forms: - number + -If or is a number, it specifies an +If '' or '' is a number, it specifies an absolute line number (lines count from 1). + -- /regex/ +- `/regex/` + This form will use the first line matching the given -POSIX regex. If is a regex, it will search from the end of +POSIX regex. If '' is a regex, it will search from the end of the previous `-L` range, if any, otherwise from the start of file. -If is ``^/regex/'', it will search from the start of file. -If is a regex, it will search -starting at the line given by . +If '' is `^/regex/`, it will search from the start of file. +If '' is a regex, it will search +starting at the line given by ''. + - +offset or -offset + -This is only valid for and will specify a number -of lines before or after the line given by . +This is only valid for '' and will specify a number +of lines before or after the line given by ''. + -If ``:'' is given in place of and , it is a +If "`:`" is given in place of '' and '', it is a regular expression that denotes the range from the first funcname line -that matches , up to the next funcname line. ``:'' +that matches '', up to the next funcname line. `:` searches from the end of the previous `-L` range, if any, otherwise -from the start of file. ``^:'' searches from the start of +from the start of file. `^:` searches from the start of file. diff --git a/Documentation/line-range-options.txt b/Documentation/line-range-options.txt index 9e3d98d44f..d2ef1a6d67 100644 --- a/Documentation/line-range-options.txt +++ b/Documentation/line-range-options.txt @@ -7,12 +7,12 @@ ifdef::gitk[] -L:::: endif::gitk[] - Trace the evolution of the line range given by "," - (or the function name regex ) within the . You may + Trace the evolution of the line range given by "','" + (or the function name regex '') within the ''. You may not give any pathspec limiters. This is currently limited to a walk starting from a single revision, i.e., you may only give zero or one positive revision arguments, and - and (or ) must exist in the starting revision. + '' and '' (or '') must exist in the starting revision. You can specify this option more than once. Implies `--patch`. Patch output can be suppressed using `--no-patch`, but other diff formats (namely `--raw`, `--numstat`, `--shortstat`, `--dirstat`, `--summary`, From patchwork Wed Oct 28 12:47:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Blain X-Patchwork-Id: 11863903 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCD98C4363A for ; Wed, 28 Oct 2020 22:41:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 74EE3218AC for ; Wed, 28 Oct 2020 22:41:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XhfKLZLp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389128AbgJ1Wl1 (ORCPT ); Wed, 28 Oct 2020 18:41:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389104AbgJ1Wl0 (ORCPT ); Wed, 28 Oct 2020 18:41:26 -0400 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1313EC0613CF for ; Wed, 28 Oct 2020 15:41:26 -0700 (PDT) Received: by mail-lf1-x144.google.com with SMTP id r127so808521lff.12 for ; Wed, 28 Oct 2020 15:41:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=fYU+dfNBH+rlVl8H7koVwTnKCfmWaaJSBPn9tUjxyu8=; b=XhfKLZLpfuydzZGm/qjrGXME1X+7qdkvo+aV1u8fuYe0ZBssp9BE1vnJNVVc7MrXwN 22OvV9U1fyT4xTqwYra9TaWVXunrEuToPrkoHB2dwmCrOLqp29JFj6BjNcPhcxlH1u8i a+JdI9efMHMyqqvTbLMwAYlFSGcmxizUjxZ0oCuorPeqX7a1RqUuNNlqM+0B/wHfsdIj TJSuL5R9oE7v2kh6y1tXSFr9Y9sYZ5je8VjzKEG9Wpoi7BO66iToDln/D24SSOdw9U/3 qJb1sOOgxWfwMnSXOXyqC/2HUfxbhm4nVyBy4P7DQDHqA1tJJQxm5OWgwMYcbjJe7qxG F/Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=fYU+dfNBH+rlVl8H7koVwTnKCfmWaaJSBPn9tUjxyu8=; b=VaNRDRQMlwp/1rB+TapVWk4aXkSkVB+EhezkrnSLJbQYlVIEKzeyMw6ckQK7j9Mvwx H8WqcmQfno4KoaG9umk8R8r/r+70OJOiemRf8eRIdVDvY5SDo4GbRzA2SXctTrdlG4gw Qi1qw6lgglognRx7k2YHf/GxGohutmF40sh5oLDMpAq4SKBxuZAVPS3XmEGsZrmR/Y3z k0RHX+oqCoQhdrQl/ZcCCYR/NqXuDAf17+YaF+qocm5YqA7AYnKy77lSD5cajZ25AR7u qIBedy329kuAlY/2J7JdL37oYe06Bf/rS+PF80zJ+T2nN90X3AwKJfjoxyjC8P2wHYTl YgIg== X-Gm-Message-State: AOAM533pFKAoOjPr6Cn6cPClXViiDPKUjxfmWfR9L0GALE6hpuAw3xCG d2lRmCwQ8sJphwE/eNbBDwa8VzbfCjE= X-Google-Smtp-Source: ABdhPJxHpCNTIkAr8chljrlZ9ILwL4ozJyUfuekxaLA3TaIYEYVvEkDXn4L02+8ITRmSoQCnqRrsEg== X-Received: by 2002:a5d:4088:: with SMTP id o8mr9043186wrp.2.1603889275021; Wed, 28 Oct 2020 05:47:55 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id c10sm5988393wmb.20.2020.10.28.05.47.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 05:47:54 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Wed, 28 Oct 2020 12:47:47 +0000 Subject: [PATCH 3/6] blame-options.txt: also mention 'funcname' in '-L' description Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Thomas Rast , Eric Sunshine , =?utf-8?b?UmVuw6k=?= Scharfe , Philippe Blain , Philippe Blain Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Philippe Blain From: Philippe Blain Make it clearer that a function can be blamed by feeding `git blame` '-L :' by mentioning it at the beginnning of the description of the '-L' option. Signed-off-by: Philippe Blain --- Documentation/blame-options.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/blame-options.txt b/Documentation/blame-options.txt index 48bf0eeec5..8b4a90e349 100644 --- a/Documentation/blame-options.txt +++ b/Documentation/blame-options.txt @@ -11,8 +11,9 @@ -L ,:: -L ::: - Annotate only the given line range. May be specified multiple times. - Overlapping ranges are allowed. + Annotate only the line range given by ',' + (or by the function name regex ''). + May be specified multiple times. Overlapping ranges are allowed. + '' and '' are optional. `-L ` or `-L ,` spans from '' to end of file. `-L ,` spans from start of file to ''. From patchwork Wed Oct 28 12:47:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Blain X-Patchwork-Id: 11864061 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C896C388F7 for ; Wed, 28 Oct 2020 23:23:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DBC6320796 for ; Wed, 28 Oct 2020 23:23:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XGcWIriH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390309AbgJ1XX3 (ORCPT ); Wed, 28 Oct 2020 19:23:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390203AbgJ1XX2 (ORCPT ); Wed, 28 Oct 2020 19:23:28 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB7F1C0613CF for ; Wed, 28 Oct 2020 16:23:27 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id w23so796101wmi.4 for ; Wed, 28 Oct 2020 16:23:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=gdHc3WPIoT6Wz+DV4JsC+xcs9U/R4ea4ajU43oT4IyU=; b=XGcWIriHr6go9Y6gN1LBMlLj8rESGqyCA5qtN5KRVW9M/JjrhA2xSUN7f2ThoSGZSN h6DIbxw5GuVa3A7E4ejheM9DJpjuPkl2Tey18Piy8flgxYMnA6JOF0Q7W0zuPT4D1oyt +6d+yrOcCG64gRq3CEpkxCCS8KgVvgboTjX/9Ve7qLYNV6lAgUqh8agzDRF/n3ki3+f/ oHfipUUQTcxUL/mAXQ5ApV5QnFTDer2kgGBnQQ5uw3fFOi8skG5PFTl/68KRIhJ7czVb sG42+pI7MQYPT4ok/yhy/ILVi9GhGFQBNzxiFhgA0uWhbx+f8zyFHdFWAjuwdYnrig95 JcZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=gdHc3WPIoT6Wz+DV4JsC+xcs9U/R4ea4ajU43oT4IyU=; b=ERHbniRYVRa/AWymIhUfExCWI4rtAuaMR/CLw8Pkc/4gyYGvKZNqjDJPqN0aMl38to RGdSNVd+1a2m5yXkw31Ol1IcuW3YI75GTV1J5MMhoRVxkRT9luHBhOR1T31xTWm3QY+6 hbxJOf3HrqVGXZ7/co9FJ/BzP1hc/cyyyB17QgHpUYyx8uA0sVtAuk47wMDFZWeGSNa0 4LlJE5txUohotLURygfaENyjehTVHDTW/3BgrsZrhqa7SHFiFiUp/+aNeoFrk1KiigBJ bkaThWlELHN6wATIM3RYh4UUJXB9aa8RATSagb0hIUPovHj+VyMspL66W6cUXm+oE5cN xBtg== X-Gm-Message-State: AOAM531xe3xa2qaZVPOKPGlB0CrB6f+cd4tcn/RaqafTuiHtmfybiKB5 w3bokHoscdA8DwkXGvpMCMQeF8sVJgU= X-Google-Smtp-Source: ABdhPJzEGc/ePs8spdrWyT7Gd+KNCMq2eAJMLQGA3OyLhtCm8TGJSs3BuOyZ/DaLhcg+nzDiArR9MA== X-Received: by 2002:a1c:1906:: with SMTP id 6mr5383337wmz.87.1603889275901; Wed, 28 Oct 2020 05:47:55 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id e3sm3353793wrn.32.2020.10.28.05.47.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 05:47:55 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Wed, 28 Oct 2020 12:47:48 +0000 Subject: [PATCH 4/6] doc: add more pointers to gitattributes(5) for userdiff Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Thomas Rast , Eric Sunshine , =?utf-8?b?UmVuw6k=?= Scharfe , Philippe Blain , Philippe Blain Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Philippe Blain From: Philippe Blain Several Git commands can make use of the builtin userdiff patterns, but it's not obvious in the documentation. Add pointers to the 'Defining a custom hunk header' part of gitattributes(5) in the description of the following options: - the '--function-context' option of `git diff` and friends - the '--function-context' option of `git grep` - the '-L :' option of `git log`, `gitk` and `git blame` In 'git-grep.txt', take the opportunity to use backticks in the description of '--show-function', and improve the wording of the desription of '--function-context'. Signed-off-by: Philippe Blain --- Documentation/diff-options.txt | 5 ++++- Documentation/git-grep.txt | 6 ++++-- Documentation/line-range-format.txt | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt index 573fb9bb71..39b511bb6b 100644 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@ -695,7 +695,10 @@ endif::git-format-patch[] -W:: --function-context:: - Show whole surrounding functions of changes. + Show whole functions as context lines for each changes. + The function names are determined in the same way as + `git diff` works out patch hunk headers (see 'Defining a + custom hunk-header' in linkgit:gitattributes[5]). ifndef::git-format-patch[] ifndef::git-log[] diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt index 6077ff01a4..4e0ba8234a 100644 --- a/Documentation/git-grep.txt +++ b/Documentation/git-grep.txt @@ -241,7 +241,7 @@ providing this option will cause it to die. --show-function:: Show the preceding line that contains the function name of the match, unless the matching line is a function name itself. - The name is determined in the same way as 'git diff' works out + The name is determined in the same way as `git diff` works out patch hunk headers (see 'Defining a custom hunk-header' in linkgit:gitattributes[5]). @@ -266,7 +266,9 @@ providing this option will cause it to die. Show the surrounding text from the previous line containing a function name up to the one before the next function name, effectively showing the whole function in which the match was - found. + found. The function names are determined in the same way as + `git diff` works out patch hunk headers (see 'Defining a + custom hunk-header' in linkgit:gitattributes[5]). --threads :: Number of grep worker threads to use. diff --git a/Documentation/line-range-format.txt b/Documentation/line-range-format.txt index 6ee159b683..ab3c70a1d5 100644 --- a/Documentation/line-range-format.txt +++ b/Documentation/line-range-format.txt @@ -27,4 +27,6 @@ regular expression that denotes the range from the first funcname line that matches '', up to the next funcname line. `:` searches from the end of the previous `-L` range, if any, otherwise from the start of file. `^:` searches from the start of -file. +file. The function names are determined in the same way as `git diff` +works out patch hunk headers (see 'Defining a custom hunk-header' +in linkgit:gitattributes[5]). From patchwork Wed Oct 28 12:47:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Blain X-Patchwork-Id: 11864075 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E4BEC55179 for ; Wed, 28 Oct 2020 23:26:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A9625207BC for ; Wed, 28 Oct 2020 23:26:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jUBTzsMI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390443AbgJ1X0g (ORCPT ); Wed, 28 Oct 2020 19:26:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390348AbgJ1XYh (ORCPT ); Wed, 28 Oct 2020 19:24:37 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83276C0613CF for ; Wed, 28 Oct 2020 16:24:37 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id k18so811644wmj.5 for ; Wed, 28 Oct 2020 16:24:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=TALQNTkPCqZi0Sh3usqwJVBnJ+g3wMucyiExSYwBcSw=; b=jUBTzsMIodTfqtz3KrFXhnA+r6uiPxGY77Xk8nh+J1x0RX8yOuQKQdHFVKYVwxhep7 lgjaCGJHuuhcjjtXZiq1w7g5ytAJ7XgDxK0gNL9W5L0eKt6CfyJ7ZK++9789qMbpGEfY pF8pv+zPxkV+7iK/LhDOdA20WYolxglFDK9Xflob9VMR1uF9IlIyLJ9fwstIIZZ4iIhS KsTj9RdWsnAMXKkmtHLRBXS5GFsZyZG5VkX5Ki4hLEpPPYSJkvxPas5Ry46gLlr1FkER deK51JyJpVFfArtMkjHjTlly8DI03oj52y+F9TzV5GTF2BUqcsMe3vCCETWQhCv0XjkQ yW3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=TALQNTkPCqZi0Sh3usqwJVBnJ+g3wMucyiExSYwBcSw=; b=CG72L/LVnTMabD8msOI2FPjHeH0nt9iScOJMEUp0m4AmeYtv0bLVAkr1umLLMYhkc+ h8hpPG6biD4ooEyNMkOhnmdxDXMu9ArL+EwLPop63TuDTn914+shUqkAp/ACbtj281lV UTRs68448OzbcUly4eMYO5qNO2daFo9rNGmgPrOqZ7IkZjtYSMo5GUekMF5jB4HpX85h IYHgboDxoWl4o5znRYvaNuNfYZKJAIz53Di4AOCKbHYPp/Ct4U4ftdhUg9YSMcGRH8Gb MnbRwU5+BWoSRJdTXTkyygqFYiHyfZcR0iqUwhGX8+T4scQ7Mkl2gdWtWK9gZG3C7wJI KSoA== X-Gm-Message-State: AOAM5316JRPnnY9oaQVePzcQwJlMjPa+nrnM+xaneV0X+AbgmCNHdNDx nhe1M2iN1B9H3pPmJ0arWUR2jzllNCE= X-Google-Smtp-Source: ABdhPJxLTbGQyadFn2mtRroAAl73sMac5dwA34ZVMdON4Ibmb/Bqs+Pg5Sr2heOMJuHRUCsVyYYICw== X-Received: by 2002:a1c:dd8b:: with SMTP id u133mr6906587wmg.73.1603889276772; Wed, 28 Oct 2020 05:47:56 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id n6sm6706669wrj.60.2020.10.28.05.47.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 05:47:56 -0700 (PDT) Message-Id: <27ef94e9cc4189c3d74e984437dcce24e1f29678.1603889270.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 28 Oct 2020 12:47:49 +0000 Subject: [PATCH 5/6] line-log: mention both modes in 'blame' and 'log' short help Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Thomas Rast , Eric Sunshine , =?utf-8?b?UmVuw6k=?= Scharfe , Philippe Blain , Philippe Blain Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Philippe Blain From: Philippe Blain 'git blame -h' and 'git log -h' both show '-L ' and describe this option as "Process only line range n,m, counting from 1". No hint is given that a function name regex can also be used. Use instead, and expand the description of the option to mention both modes. Remove "counting from 1" as it's uneeded; it's uncommon to refer to the first line of a file as "line 0". Also, for 'git log', improve the wording to better reflect the long help. Signed-off-by: Philippe Blain --- builtin/blame.c | 3 ++- builtin/log.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/builtin/blame.c b/builtin/blame.c index bb0f29300e..05f69211dd 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -889,7 +889,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix) OPT_STRING(0, "contents", &contents_from, N_("file"), N_("Use 's contents as the final image")), OPT_CALLBACK_F('C', NULL, &opt, N_("score"), N_("Find line copies within and across files"), PARSE_OPT_OPTARG, blame_copy_callback), OPT_CALLBACK_F('M', NULL, &opt, N_("score"), N_("Find line movements within and across files"), PARSE_OPT_OPTARG, blame_move_callback), - OPT_STRING_LIST('L', NULL, &range_list, N_("n,m"), N_("Process only line range n,m, counting from 1")), + OPT_STRING_LIST('L', NULL, &range_list, N_("range"), + N_("Process only the given line range (=,) or function (=:)")), OPT__ABBREV(&abbrev), OPT_END() }; diff --git a/builtin/log.c b/builtin/log.c index 0a7ed4bef9..e6a3bb7803 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -183,8 +183,8 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix, N_("pattern"), N_("do not decorate refs that match ")), OPT_CALLBACK_F(0, "decorate", NULL, NULL, N_("decorate options"), PARSE_OPT_OPTARG, decorate_callback), - OPT_CALLBACK('L', NULL, &line_cb, "n,m:file", - N_("Process line range n,m in file, counting from 1"), + OPT_CALLBACK('L', NULL, &line_cb, "range:file", + N_("Trace the evolution of the given line range (=,) or function (=:) in "), log_line_range_callback), OPT_END() }; From patchwork Wed Oct 28 12:47:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Blain X-Patchwork-Id: 11864057 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4045C4363A for ; Wed, 28 Oct 2020 23:20:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 545C020791 for ; Wed, 28 Oct 2020 23:20:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="He/PKOnl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733201AbgJ1XUv (ORCPT ); Wed, 28 Oct 2020 19:20:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730788AbgJ1XUs (ORCPT ); Wed, 28 Oct 2020 19:20:48 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73C0AC0613CF for ; Wed, 28 Oct 2020 16:20:47 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id c16so822937wmd.2 for ; Wed, 28 Oct 2020 16:20:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=YFY34Sv9mxNHpZFo3ZGG6+7MPt1mRoBBhW9cIeemJ7s=; b=He/PKOnlapIyOZPjl887SpOxieA13ZXO0gf8ANcrjSmIQtWMqbN7Y8mZDa+WfRYMTu dJGbOYpc9oUq0iKhLsOqQuojsy7Gok1cHLx2RG6XyQr7aKOgzupvIoDe51sn0kL5BTwS ZqhWuUM3SKQ99XzfWgx17e+dXzpuk26yyQXDqbBve4HNpeTKpYwN0Ebj02XJGVED1doH HDfkloll2F8au24Fs9ddzv7mGsrlD4uSi6SfqemwbsNszqu3fqhJ74aOIk2j+gC3Plpg oGhv8V68D+MG4QoMzrlpaYoWcRiEIF77PrvSDy4gZhtxOvDzw5yLkkjsHglGO561yx4Q syZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=YFY34Sv9mxNHpZFo3ZGG6+7MPt1mRoBBhW9cIeemJ7s=; b=HM3IwfGEepJMdwrD2U8hvq/WD7yK/3J6YPYW03NTy7IppfAi4ybyX3sWYW8z4OslDm rL1osAj0PmK6N18PG+H1T3UHVs8TtwYpfbp5VKlRRV8pEbkcrJrML8AGG73Sy/JCwBb5 2HhdAgukqOzUnZb4+oaQI6TrPTMuqhEu0Hhos2lHCT2OdirOEiJqfka4OjU9vYyMqvqt OryKP8jyiGw+PKD5AdLjwYDJBAvrXzIbnEy5yufr2viBJ96I+Z2doef5gOMvTaEXYYQE 8DSaOSIYfN/FKAe6n0HDrBWJ3Xx9h/LOLVc+gIgH0e5rLrhbZO838quLvVQPzM4+XfMJ dUuQ== X-Gm-Message-State: AOAM533kjmL+yAGSgSfdrO4DlrOjDI3VSrvBACIH3lF40xihiYBbvyLa e+p5+PQMHLfc+EqYPfKh/zawwiSoIvE= X-Google-Smtp-Source: ABdhPJw7gxwX1JpT4Ip1eCqj9zodiGR3jSAwbgPUshpGA8rZued9f5C6fH3gYZoryoEbgoEoZek0Aw== X-Received: by 2002:a05:600c:2256:: with SMTP id a22mr8102553wmm.138.1603889277746; Wed, 28 Oct 2020 05:47:57 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id k18sm6582769wrx.96.2020.10.28.05.47.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2020 05:47:57 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Wed, 28 Oct 2020 12:47:50 +0000 Subject: [PATCH 6/6] blame: enable funcname blaming with userdiff driver Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Thomas Rast , Eric Sunshine , =?utf-8?b?UmVuw6k=?= Scharfe , Philippe Blain , Philippe Blain Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Philippe Blain From: Philippe Blain In blame.c::cmd_blame, we send the 'path' field of the 'sb' 'struct blame_scoreboard' as the 'path' argument to 'line-range.c::parse_range_arg', but 'sb.path' is not set yet; it's set to the local variable 'path' a few lines later at line 1137. This 'path' argument is only used in 'parse_range_arg' if we are blaming a funcname, i.e. `git blame -L : `, and in that case it is sent to 'parse_range_funcname', where it is used to determine if a userdiff driver should be used for said to match the given funcname. Since 'path' is yet unset, the userdiff driver is never used, so we fall back to the default funcname regex, which is usually not appropriate for paths that are set to use a specific userdiff driver, and thus either we match some unrelated lines, or we die with fatal: -L parameter '' starting at line 1: no match This has been the case ever since `git blame` learned to blame a funcname in 13b8f68c1f (log -L: :pattern:file syntax to find by funcname, 2013-03-28). Enable funcname blaming for paths using specific userdiff drivers by sending the local variable 'path' to 'parse_range_arg' instead of the yet unset 'sb.path'. Add a regression test in 'annotate-tests.sh', which is sourced in t8001-annotate.sh and t8002-blame.sh, leveraging an existing file used to test the userdiff patterns in t4018-diff-funcname. Signed-off-by: Philippe Blain --- builtin/blame.c | 2 +- t/annotate-tests.sh | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/builtin/blame.c b/builtin/blame.c index 05f69211dd..917fedc635 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -1104,7 +1104,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix) long bottom, top; if (parse_range_arg(range_list.items[range_i].string, nth_line_cb, &sb, lno, anchor, - &bottom, &top, sb.path, + &bottom, &top, path, the_repository->index)) usage(blame_usage); if ((!lno && (top || bottom)) || lno < bottom) diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh index d933af5714..3aee61d2cc 100644 --- a/t/annotate-tests.sh +++ b/t/annotate-tests.sh @@ -479,6 +479,24 @@ test_expect_success 'blame -L ^:RE (absolute: end-of-file)' ' check_count -f hello.c -L$n -L^:ma.. F 4 G 1 H 1 ' +test_expect_success 'setup -L :funcname with userdiff driver' ' + echo "fortran-* diff=fortran" >.gitattributes && + fortran_file=fortran-external-function && + orig_file="$TEST_DIRECTORY/t4018/$fortran_file" && + cp $orig_file . && + git add $fortran_file && + GIT_AUTHOR_NAME="A" GIT_AUTHOR_EMAIL="A@test.git" \ + git commit -m "add fortran file" && + sed -e "s/ChangeMe/IWasChanged/" <"$orig_file" >$fortran_file && + git add $fortran_file && + GIT_AUTHOR_NAME="B" GIT_AUTHOR_EMAIL="B@test.git" \ + git commit -m "change fortran file" +' + +test_expect_success 'blame -L :funcname with userdiff driver' ' + check_count -f fortran-external-function -L:RIGHT A 7 B 1 +' + test_expect_success 'setup incremental' ' ( GIT_AUTHOR_NAME=I && From patchwork Sun Nov 1 17:28:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Blain X-Patchwork-Id: 11872293 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 955F1C4742C for ; Sun, 1 Nov 2020 17:29:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 60B4022265 for ; Sun, 1 Nov 2020 17:29:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rWTCpBaq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727187AbgKAR3B (ORCPT ); Sun, 1 Nov 2020 12:29:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727024AbgKAR24 (ORCPT ); Sun, 1 Nov 2020 12:28:56 -0500 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67DBDC061A04 for ; Sun, 1 Nov 2020 09:28:56 -0800 (PST) Received: by mail-wm1-x344.google.com with SMTP id h22so7309659wmb.0 for ; Sun, 01 Nov 2020 09:28:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=Qp9LJkMZYRVCG5zfjufBRRQ52gm6+FiPNG9T/qFDJ5g=; b=rWTCpBaqESYOlcLJMwRfaERcJz3ufLibXftmiDxBqoTu72y6RgUt0UsRb/ZoQ+Rt1s S3cwk0ouEfixX0mSJUdNbvSTm6du8kYFRuz7GAYzqR5O9bisqi5vKy8jfXD2BwcsecsG x/ZccJtSpPoN3g7+WHk3r2IwRJ6l3Xf4BniUAvydYzaP0d/mkhYLaUg2SPLHXguNs2en JOUKq9ueKXt+cWXNG4+mkgkTvuwEGwf+q8m4yktrb79CqsaLt8JMSDOVIL1wuLf5+9Zv fUqxmEH03Lgsp1/5CmfwG9pEy4jeIA6XrnucX4S2zUxSUErgOdxTsReJWDIXJQW4nc6U 5esQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=Qp9LJkMZYRVCG5zfjufBRRQ52gm6+FiPNG9T/qFDJ5g=; b=L+JP2Ssb+fJ3Q08/JhY0noUhZ8MeWxTu7YCn8cga4y6hAV2ivNmQn8LKLuOF+50k8N 9NiN2Vv5NixdoDON3IZ/xT8FOnIgb48n5qwG+7FdX/+YWA4yGCHZIaleGUIf/B3mN+uI +jj8QA4Dna6QohfQ4NKTpHDr+AN25hJOmlTvhE/FMWSgyQDeFBBgGzPUjON//qz8qPJG KZlym9yVryCqvNkshyJnMIEfLSU+oWDmI8ebicOru6VzKANm/ZVRGVHX6ffQGDYeYnzc n3XwDIHWO50uux/YRIu1n6E5Oh2rdRjUbLAOdHF83ubU13AV1pO6tXm60qiDow/5hkoA lGpw== X-Gm-Message-State: AOAM533UZ0KWEDbkXoVWgT6v1eJ0pN3V63ltjBERYxrH9sZlFOWVU5Uu Syb+lm5cP6UPRZKYVqXprqERX4ZLtOA= X-Google-Smtp-Source: ABdhPJyeOntwsk+8Ar+uSKdxdwz198pdJJ/KILOYeiHqkogfRs2LcaQD1pI86fTXdmh+4cXJ1GlKxw== X-Received: by 2002:a7b:cc92:: with SMTP id p18mr13839091wma.116.1604251735017; Sun, 01 Nov 2020 09:28:55 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id a12sm4067824wrr.31.2020.11.01.09.28.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Nov 2020 09:28:54 -0800 (PST) Message-Id: <3b28696e51a9ba370d25b70844b9fb57a4bfaab2.1604251728.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 01 Nov 2020 17:28:46 +0000 Subject: [PATCH v2 7/8] blame: simplify 'setup_scoreboard' interface Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Philippe Blain , Philippe Blain , Philippe Blain Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Philippe Blain From: Philippe Blain The previous commit moved the initialization of 'sb.path' in 'builtin/blame.c::cmd_blame' before the call to 'blame.c::setup_scoreboard'. Since 'cmd_blame' is the only caller of 'setup_scoreboard', it is now unnecessary for 'setup_scoreboard' to receive 'path' as a separate argument, as 'sb.path' is already initialized. Remove this argument from setup_scoreboard's interface and use the 'path' field of the 'sb' 'struct blame_scoreboard' instead. Signed-off-by: Philippe Blain --- blame.c | 11 +++++------ blame.h | 1 - builtin/blame.c | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/blame.c b/blame.c index 686845b2b4..128cb7ba55 100644 --- a/blame.c +++ b/blame.c @@ -2764,7 +2764,6 @@ void init_scoreboard(struct blame_scoreboard *sb) } void setup_scoreboard(struct blame_scoreboard *sb, - const char *path, struct blame_origin **orig) { const char *final_commit_name = NULL; @@ -2803,7 +2802,7 @@ void setup_scoreboard(struct blame_scoreboard *sb, setup_work_tree(); sb->final = fake_working_tree_commit(sb->repo, &sb->revs->diffopt, - path, sb->contents_from); + sb->path, sb->contents_from); add_pending_object(sb->revs, &(sb->final->object), ":"); } @@ -2846,12 +2845,12 @@ void setup_scoreboard(struct blame_scoreboard *sb, sb->final_buf_size = o->file.size; } else { - o = get_origin(sb->final, path); + o = get_origin(sb->final, sb->path); if (fill_blob_sha1_and_mode(sb->repo, o)) - die(_("no such path %s in %s"), path, final_commit_name); + die(_("no such path %s in %s"), sb->path, final_commit_name); if (sb->revs->diffopt.flags.allow_textconv && - textconv_object(sb->repo, path, o->mode, &o->blob_oid, 1, (char **) &sb->final_buf, + textconv_object(sb->repo, sb->path, o->mode, &o->blob_oid, 1, (char **) &sb->final_buf, &sb->final_buf_size)) ; else @@ -2861,7 +2860,7 @@ void setup_scoreboard(struct blame_scoreboard *sb, if (!sb->final_buf) die(_("cannot read blob %s for path %s"), oid_to_hex(&o->blob_oid), - path); + sb->path); } sb->num_read_blob++; prepare_lines(sb); diff --git a/blame.h b/blame.h index b6bbee4147..e8c185c8ef 100644 --- a/blame.h +++ b/blame.h @@ -181,7 +181,6 @@ const char *blame_nth_line(struct blame_scoreboard *sb, long lno); void init_scoreboard(struct blame_scoreboard *sb); void setup_scoreboard(struct blame_scoreboard *sb, - const char *path, struct blame_origin **orig); void setup_blame_bloom_data(struct blame_scoreboard *sb, const char *path); diff --git a/builtin/blame.c b/builtin/blame.c index f2e528fcbc..5d8f4c4599 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -1085,7 +1085,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix) build_ignorelist(&sb, &ignore_revs_file_list, &ignore_rev_list); string_list_clear(&ignore_revs_file_list, 0); string_list_clear(&ignore_rev_list, 0); - setup_scoreboard(&sb, path, &o); + setup_scoreboard(&sb, &o); /* * Changed-path Bloom filters are disabled when looking