From patchwork Sun Nov 1 17:28:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Blain X-Patchwork-Id: 11872299 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 6FC0AC2D0A3 for ; Sun, 1 Nov 2020 17:28:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 199802225C for ; Sun, 1 Nov 2020 17:28:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NSfSAkB/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727081AbgKAR2w (ORCPT ); Sun, 1 Nov 2020 12:28:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727024AbgKAR2v (ORCPT ); Sun, 1 Nov 2020 12:28:51 -0500 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6143BC061A04 for ; Sun, 1 Nov 2020 09:28:51 -0800 (PST) Received: by mail-wr1-x434.google.com with SMTP id a9so11892495wrg.12 for ; Sun, 01 Nov 2020 09:28:51 -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=bJwfGHssSO7FwyQCHCC+rZiTBwG6EPhpyDUb1/9NjEY=; b=NSfSAkB/GFjDyRpTj0vRZ07vteUmJnFJUh9FDwjGqCJ5q3qKnGRz1Ske9wio/+4T8O epBNqa0GN+61HidsKMfw5IAz/LKJi1bYKw5yqh9v21ufzlp2BL/qRUojRr0YO0jGGylf 4dYphjr1tvvXEAFefBECR2X4XR0eIbDgrX5pKR8aP8Ak2QC8LFK/Qc7Z3YfxpcmSLQPl Seh7xS7ONr3ZyD8FAoqZ86Lf5g1sN3vRZ9E15QQ0M8+jsRRirTYslBoda2xPJT2jCOX9 cr/ehhrLTH1VJ4zj/SpQAejkx4V5p0IPuqx831ACtpBhOzl3g1JMkUbp8k90G8lRvejz NGTQ== 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=bJwfGHssSO7FwyQCHCC+rZiTBwG6EPhpyDUb1/9NjEY=; b=EkaW9c16VwYqhyenbUDkvms5bmXbmGba8e/S2foy78iPoJxYohBVXnSxL0XCHaTImH FgQM6NNM48gVdqQjAPaIlDRAwfMeAuGmMK0Z5Zr/edgSkXhMkBRCMKMNPvdwuplNrH8k AmXsVupndfr0GKu8DMx5wLXyejzh57jOfRFEIlLvFlvvNl7dpiGilUekzpYeypbQ0MTs jUWcQYjvFayR+ViM7nMAxdGtmjxR2mjSj1OvSnyQRBIK5ySA8UBZLNpuiw2kFv1hDENL 0ii+eKo845N4ry5xY9OtFbsrH0y0sjxPN9YO7DVhD7xbUqfz1tUDYG+vWPxJvz1TnUiB tQzQ== X-Gm-Message-State: AOAM533uQxL+WPU7HTnwd5+nrin8GpCnSMYOXd1pTGcYzlqbdNW2umFH OUg3GIRZn6Sic7+QGwHYeyU1bxAsdkU= X-Google-Smtp-Source: ABdhPJyTJrXmdLydSgUJ3Mzuwfjrr6JzkbKBTe8rN5u4Ly1YaMROMcGVQN9TthnIyaqhNQX9zv1yew== X-Received: by 2002:adf:c3c6:: with SMTP id d6mr15819849wrg.206.1604251729889; Sun, 01 Nov 2020 09:28:49 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id a17sm19311663wra.29.2020.11.01.09.28.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Nov 2020 09:28:49 -0800 (PST) Message-Id: In-Reply-To: References: Date: Sun, 01 Nov 2020 17:28:40 +0000 Subject: [PATCH v2 1/8] doc: log, gitk: move '-L' description to 'line-range-options.txt' 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 description of the '-L' option for `git log` and `gitk` is almost the same, but is repeated in both 'git-log.txt' and 'gitk.txt' (the difference being that 'git-log.txt' lists the option with a space after '-L', while 'gitk.txt' lists it as stuck and notes that `gitk` only understands the stuck form). Reduce duplication by creating a new file, 'line-range-options.txt', and include it in both files. To simplify the presentation, only list the stuck form for both commands, and remove the note about `gitk` only understanding the stuck form. Signed-off-by: Philippe Blain --- Documentation/git-log.txt | 15 +-------------- Documentation/gitk.txt | 20 +------------------- Documentation/line-range-options.txt | 15 +++++++++++++++ 3 files changed, 17 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..dd189a353a 100644 --- a/Documentation/git-log.txt +++ b/Documentation/git-log.txt @@ -77,20 +77,7 @@ 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[] +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..d50e9ed10e 100644 --- a/Documentation/gitk.txt +++ b/Documentation/gitk.txt @@ -98,25 +98,7 @@ 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[] +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..266263f6b4 --- /dev/null +++ b/Documentation/line-range-options.txt @@ -0,0 +1,15 @@ +-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[] From patchwork Sun Nov 1 17:28:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Blain X-Patchwork-Id: 11872297 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 33B44C4742C for ; Sun, 1 Nov 2020 17:28:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0016822265 for ; Sun, 1 Nov 2020 17:28:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ptWka37z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727153AbgKAR2y (ORCPT ); Sun, 1 Nov 2020 12:28:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727086AbgKAR2x (ORCPT ); Sun, 1 Nov 2020 12:28:53 -0500 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 0EEC5C061A04 for ; Sun, 1 Nov 2020 09:28:53 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id 13so7246865wmf.0 for ; Sun, 01 Nov 2020 09:28:52 -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=SzdJTTCzvY22cpUuKgXDJ1J0DyVQ8i2sAbzsX73+t6I=; b=ptWka37zvg5zrfYvwP4teER0DemTfk9fTsWTM50KUSVT+G10tH4RyeAEUduag9xj47 qH3qV7mN2gXTL/r9XEnAc3iEFmSc8TULsrJNF80K8sgw9j4acvLcnyLIpowUi1CAyQf3 kB2Mk+NzU+3NH3Gj/2PFSAki3bTf27Hgi5gIYzbZ9q1tOUCNNdEQATUr1wPqcwLj1MTz VKYF/kxVjyk1yhe/zUSAXDO2H2DTgJn0R4/UKS67NMBI65e0qFgzlXufqqZ79gSVgxzQ WyzGjtA+SNgnh0EYjSUpCKWiurL1tvUiIXbyTnlQf7GpSNw3ityl78LT5UzjWgyJAVJl J5DA== 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=SzdJTTCzvY22cpUuKgXDJ1J0DyVQ8i2sAbzsX73+t6I=; b=KzferB6KhtAyvR/BF9pMd6futdv9cztLkuwJ0RDNDHg9H7QQw4Brb6LylzfnCYGwEm Z3+PqHv7lYgBzQMuobhUgXyB9kaU6+QzpP8eT/1uXmtlZiJPVAkyOxs/ov2VYge/ZVJW SXzGsViALK2pdjm6luj0bYUbXt0heKw3koIUDtAt1qOnb4AtZGek74BHPZT/sAifXJhq 8wSadlqdAbRM918apSra/MOufQtT4dWN3HK3NZ92/Hu+HlO8+md1t8+n6O82PJvuBxu8 8m/9jLzXZHxxV4oYrkyRViiizUmIyKmEiidFJZ5z7olHLeQ6B4ytz1isLkUnnjbr/get O9tA== X-Gm-Message-State: AOAM531b5Wq5DwRYlySfF6cqUqfJpWQnxkCTKVvlGk3JcS7rZXdHV4nA XybzcJjvxpAPzhBU+Ce+/FkI9Mpzu5c= X-Google-Smtp-Source: ABdhPJxen3r5uAh+CugqZuwRz6N8MOVgHL6aNAWtoEzeHbE2bef+cdcE3N2GDc8WwmG7NVeXnYWA8Q== X-Received: by 2002:a1c:f002:: with SMTP id a2mr14313021wmb.129.1604251731649; Sun, 01 Nov 2020 09:28:51 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id u81sm2039619wmb.27.2020.11.01.09.28.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Nov 2020 09:28:51 -0800 (PST) Message-Id: In-Reply-To: References: Date: Sun, 01 Nov 2020 17:28:42 +0000 Subject: [PATCH v2 3/8] blame-options.txt: also mention 'funcname' in '-L' description 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 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. Also, in 'line-range-options.txt', which is used for git-log(1) and gitk(1), do not parenthesize the mention of the ':' mode, to place it on equal footing with the ',' mode. Signed-off-by: Philippe Blain --- Documentation/blame-options.txt | 5 +++-- Documentation/line-range-options.txt | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Documentation/blame-options.txt b/Documentation/blame-options.txt index 48bf0eeec5..dc3bceb6d1 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 ''. diff --git a/Documentation/line-range-options.txt b/Documentation/line-range-options.txt index 1c90127300..8e295a62b8 100644 --- a/Documentation/line-range-options.txt +++ b/Documentation/line-range-options.txt @@ -1,8 +1,8 @@ -L,::: -L:::: - 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 by 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 From patchwork Sun Nov 1 17:28:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Blain X-Patchwork-Id: 11872295 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 31031C388F9 for ; Sun, 1 Nov 2020 17:28:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E675A2225C for ; Sun, 1 Nov 2020 17:28:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OJFN2H1t" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727157AbgKAR2y (ORCPT ); Sun, 1 Nov 2020 12:28:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727024AbgKAR2y (ORCPT ); Sun, 1 Nov 2020 12:28:54 -0500 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDEBAC0617A6 for ; Sun, 1 Nov 2020 09:28:53 -0800 (PST) Received: by mail-wr1-x441.google.com with SMTP id 33so1124620wrl.7 for ; Sun, 01 Nov 2020 09:28:53 -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=lYkCC/XhpsvZEYMbyETUyzIgqzKocwovbfQT60HnuCs=; b=OJFN2H1t6nqJbnok0NhaQzagh3Gl84xwwp07wojarHrM2BZE5In0oIilJ8RCmFdVco Q0pGRINrzIUgAdC9tgo5CyP5P7LkbOEN0ToEDyuH96K8GluMKt2DA7U/BDfkFTkoqrw7 NPVyC+IwrX7NezQCSVOPEV15K+7H2UppnyS10GN4SXviiHwJfJfcXD+4/gLogx0Q+9Za mCi0zPxIX4go36en7TGQ1OXQuFPeeqjxcUCCMWUQ9AEJIktW1WV/9mIQ9mM/OPdwHiXh pMnZYSaxNqapgsHx8WAqYBMBeeP7EZYNRi0XnuFfRbncDWPNGACXBa2YxLLYL70bvTgN oQUw== 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=lYkCC/XhpsvZEYMbyETUyzIgqzKocwovbfQT60HnuCs=; b=hgNOeUwXgckpyy9jYO0BRTRRGQvMGpg5+Yx9i8lSxN85/2zU5gBmLSyNbdAI6xzazV pfjLeeI0far9g1rlXPBBQVKRTUzbxOuK6f6F7Ml4H+x1eE+mfBCkeYKD7Y9YTpiRTP/x zst28eKMweTWB68w4LzU+zs7QkIsWvrxrC8IFVh3LzKqaC/V9VaJffKD7W5m8SFnE2/f c2VF5MX/duTuAf4YzXLbq6Y2KTac8lAHmfBtouXiwr92OlzJQqbooU3Xk/tNXdcFP9UJ x0NxcVijZqgs7tB5kXspm+6SX2tRmDqgGTeOvBIzR49rGqmW8wN7sO5Cz75E5SQi1cHG YFcw== X-Gm-Message-State: AOAM531OX0Ktl5sBpjKctka7LpngCFeV9uURrIHCKP3wpFCkvHG0KcYN fzEgCjNujzDou6k4y74Za2BBV9p/PCA= X-Google-Smtp-Source: ABdhPJwzrVPkbZsxxbhSNFP59+/I+uwIsO19BimTnLZKMcJm5lRIOKwp9rz/sYEbO/WxEg7HQsC+SA== X-Received: by 2002:a5d:660a:: with SMTP id n10mr15836811wru.59.1604251732393; Sun, 01 Nov 2020 09:28:52 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id i2sm4049215wmc.28.2020.11.01.09.28.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Nov 2020 09:28:52 -0800 (PST) Message-Id: <9443a681e3c26410d0c262ac52fc604b39a89421.1604251728.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 01 Nov 2020 17:28:43 +0000 Subject: [PATCH v2 4/8] doc: add more pointers to gitattributes(5) for userdiff 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 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..72b558ce21 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 function as context lines for each change. + 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 43759eef89..9b51e9fb66 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 Sun Nov 1 17:28:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Blain X-Patchwork-Id: 11872303 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 4081DC55178 for ; Sun, 1 Nov 2020 17:28:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E997222268 for ; Sun, 1 Nov 2020 17:28:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ycd5HXZV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726790AbgKAR24 (ORCPT ); Sun, 1 Nov 2020 12:28:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727024AbgKAR2z (ORCPT ); Sun, 1 Nov 2020 12:28:55 -0500 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99CEFC0617A6 for ; Sun, 1 Nov 2020 09:28:54 -0800 (PST) Received: by mail-wr1-x441.google.com with SMTP id w1so11936123wrm.4 for ; Sun, 01 Nov 2020 09:28:54 -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=djn1VAWcD1Br4UvqOydWf0SGdcel8IzKRyZ/nnATuVw=; b=Ycd5HXZVb/nzHCBQwI2QFNXr1Ta1zuEb/Ald7zqca+medVgEDE2+iX72KRinhslkRy pmZE88fuCY3OfnTBKS2LP4g/MEA3PTtxNyCuxiecX6lAFhxFJiiSwiZYrU8d9wk/3Q6w cMKLye1S9lHVO7L+KrAZ2ZrhhZiHOsMw9dduSuyNrSpaohB/ejEKP5AG+CkSsY7+jbsh hel7SN0tJFMe5s4y5iwRPk53jVMumcVTx83cIN+R09VUhZoe1qNCAOO+ZkPJb7DxwvuV N8iH6FruuJ2/49klwXnf4EWKualC7Soam20juG++lNTlT++9mOgtQtrKuE/rRbZqLxgN IMVA== 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=djn1VAWcD1Br4UvqOydWf0SGdcel8IzKRyZ/nnATuVw=; b=kvwCNNJ4uOrS6nAGUGtkwKjzLTAIRX4gmBgwk0MboQwkv1vIaTebM2zf6DMgP+CxaI rlf8W7V6VNdaXRtbiO/6Q4ac8ZsQKazXILuXtL4b301J/UtIb3ff3bHxQIKlO8Gb/LIS YxN47BFn0r/7D+pvJ9D9ypPzbvETh27t8n8KHNnEEpTdo25aTxPtAunpdyWiJezzcVmP C+Sq0rp+DFrFWUju7uwSSVbkVbQDkDOfsylrm+UEpBnmn2dNKOMdPsUHxFZN+jKudnGD JsxEA2SgJpB5sxmZgrhEwFhCkG39CDkYZ0i1k9vkkV5mDFXbJdFtP33/Kjez2CKWSr/0 cvfw== X-Gm-Message-State: AOAM530qLRVKN6HIND9ENmSLxbEAODdL1DcMI6XNV5nvGHE9n2/uk9lw MjF+MJXU1we/Hn/dCQysau+U9acp67w= X-Google-Smtp-Source: ABdhPJwrx1k/vGtpBID1+Tpug0fs0Zs63sP9Z5Fm0hoYOEs0gzm+r2BzIneDxksghpGzIyMc9Mj6gg== X-Received: by 2002:a5d:6506:: with SMTP id x6mr16444635wru.71.1604251733222; Sun, 01 Nov 2020 09:28:53 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id s133sm5684863wmf.30.2020.11.01.09.28.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Nov 2020 09:28:52 -0800 (PST) Message-Id: In-Reply-To: References: Date: Sun, 01 Nov 2020 17:28:44 +0000 Subject: [PATCH v2 5/8] line-log: mention both modes in 'blame' and 'log' short help 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 '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..224b6f18d4 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 line range , or function :")), OPT__ABBREV(&abbrev), OPT_END() }; diff --git a/builtin/log.c b/builtin/log.c index 0a7ed4bef9..c87ce09325 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 line range , or function : in "), log_line_range_callback), OPT_END() }; From patchwork Sun Nov 1 17:28: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: 11872291 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 14B9EC56201 for ; Sun, 1 Nov 2020 17:28:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D35C322265 for ; Sun, 1 Nov 2020 17:28:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="geZ0KJmJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727181AbgKAR25 (ORCPT ); Sun, 1 Nov 2020 12:28:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727167AbgKAR24 (ORCPT ); Sun, 1 Nov 2020 12:28:56 -0500 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE521C0617A6 for ; Sun, 1 Nov 2020 09:28:55 -0800 (PST) Received: by mail-wr1-x443.google.com with SMTP id b8so11950423wrn.0 for ; Sun, 01 Nov 2020 09:28:55 -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=pvTbOkVCej7vBaecVN/j5bcrCnYzWqRKkM9jAV/hLb8=; b=geZ0KJmJJQ4yTBZcCXBWmCMmsiTPoeDcQMa2OyTq6ho3KnA7P1dHWDEm2Rp17DgMG4 e837QTusbTOyIDlKKg1kC8m355ewj4RxENxptGmhpL+tLFMQE/aFcdGHiOJuiwIJiNfF HCpTU8cIFOa9GYdzGppv35yo39Cz2eEFyjck77IeibHBWjdITmSCjeCeWgq5xrbegmCl Esi2f6De1GqNORAOnYApjbfyno+V4zu4bWtJLmfOLv6kc2A6BzVjiYhc/IU1UiTMquL4 /jRPh/nnmrFvIVVG6EWeNeXm0cdbaL4A3dMSlt86YIecxlpyVW5sNPOhQ8Z3pGz1ZzVu V/mA== 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=pvTbOkVCej7vBaecVN/j5bcrCnYzWqRKkM9jAV/hLb8=; b=SynQyUVROYlIjoOBZJIll7blF88lUZ+dKGQ6/FfVhkca5jPmIOWHqgddszi5fawm4D qFqXl7xEZ+jEpkI697szrhwlMtBxg3gNLh55veUNwe/SUZjO+xhRzNqJXebrqxzXjBef krPWAs1OESeumsqyGLuLvy1VCsJ0DgWWXGQJe2Anb3N4nGpq/BP1VCVdkrm2I/fGWAci DXBICGzMc+aEi3B8SgzEQP86wqjM4T0Eu/aV9BlJe0bun4nKnHFXFC7UEH8onqpnC8k6 DhWlkaEnUqhN9i7feHLBoJ9xDs4bXMqR/BKzZh0b8Wk0rchpbZ+SfSNdh+3Q26TQi3Jm PK/w== X-Gm-Message-State: AOAM531YUrLQbElfTzzVrsY7kzpzJ2U7N8RnxFbvd1tQCtwBP5qlYErS B2NpnF2lJs/QeA3z0dEYdtLIR9YTg08= X-Google-Smtp-Source: ABdhPJwH6NHEiAqOlYonwRy4BWB8njk+a5z4vLUmWgcrkxNz74ynp0xT85bEtqJJOroD/aCtlTRk4Q== X-Received: by 2002:adf:e610:: with SMTP id p16mr8720477wrm.302.1604251734221; Sun, 01 Nov 2020 09:28:54 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id x65sm12063590wmg.1.2020.11.01.09.28.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Nov 2020 09:28:53 -0800 (PST) Message-Id: In-Reply-To: References: Date: Sun, 01 Nov 2020 17:28:45 +0000 Subject: [PATCH v2 6/8] blame: enable funcname blaming with userdiff driver 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 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 initializing 'sb.path' earlier in 'cmd_blame', when some of its other fields are initialized, so that it is set when passed to 'parse_range_arg'. 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. Also, use 'sb.path' instead of 'path' when constructing the error message at line 1114, for consistency. Signed-off-by: Philippe Blain --- builtin/blame.c | 4 ++-- t/annotate-tests.sh | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/builtin/blame.c b/builtin/blame.c index 224b6f18d4..f2e528fcbc 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -1081,6 +1081,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix) sb.contents_from = contents_from; sb.reverse = reverse; sb.repo = the_repository; + sb.path = path; 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); @@ -1110,7 +1111,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix) if ((!lno && (top || bottom)) || lno < bottom) die(Q_("file %s has only %lu line", "file %s has only %lu lines", - lno), path, lno); + lno), sb.path, lno); if (bottom < 1) bottom = 1; if (top < 1 || lno < top) @@ -1135,7 +1136,6 @@ int cmd_blame(int argc, const char **argv, const char *prefix) string_list_clear(&range_list, 0); sb.ent = NULL; - sb.path = path; if (blame_move_score) sb.move_score = blame_move_score; 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: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: 11872305 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 EC067C2D0A3 for ; Sun, 1 Nov 2020 17:29:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B6E5F22265 for ; Sun, 1 Nov 2020 17:29:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fd3nOy8K" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727193AbgKAR3B (ORCPT ); Sun, 1 Nov 2020 12:29:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727175AbgKAR25 (ORCPT ); Sun, 1 Nov 2020 12:28:57 -0500 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22588C0617A6 for ; Sun, 1 Nov 2020 09:28:57 -0800 (PST) Received: by mail-wr1-x441.google.com with SMTP id w1so11936188wrm.4 for ; Sun, 01 Nov 2020 09:28:57 -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=KtM3ah1m5iPmVtqoSDImGvgde4PfPAlNe1t2WvU6tiY=; b=fd3nOy8K56FOGYAecHvEkq3xhsFTSb8ddCJaq62N7/JuXPuBK5ZjKK2dfYoNNWBVqR YAWrk/LPLUfKWYJkJuP6cqapsaPuzv+UBJuymKt/tJ+zn+TT8JTpFxeZCbzWeYLg9eLF sVuILYjM/fupeVcMH+8AvASbw9beIGKIWaWEsa0oeI4z5ewAc7f4HQDDr80I5S24JaVJ 1s59IID3/J8fNTJ9mxrpB+ARkcwT4xHTqGB00/K/XFtYkklo9BPstKGVWxmnEfI3Jjp6 k7xSuj8rxRZnqQw/0kMCQkOnKHKTA/dfmy3xfBxT2g3281WM7f6B6pnY2uEt3NL/H+0q LBkA== 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=KtM3ah1m5iPmVtqoSDImGvgde4PfPAlNe1t2WvU6tiY=; b=WoMhEETJwh//pLxWaYa/4xK6bXuF6Ea24k+crF/W6sHEQtjH3NxRea/IDMULbk2VA7 ILAW/ev4IEkcAO703p2Uvi8ecvBI8G1/NNzm234mYJOj3N8B5Njn+d6KuXCwUkzJLPEX h2dloN9hu4YR0s+RbXX+IP8Ekx+v6THvAbXe/xe0yf5zTrsuqOP4kDVfLEC9Ox9LwvRJ m9UQ5pFYnGUUv9X5eoTYkrJbSv+dAlC3ZsE3zYco9Gp+v0yHg7tsWYNJyB0mv/PVxnkX +sABFYJgkO7TXi0T52DF6atEtYrPyWWifKpn8g5iW5V89JlL3lc6/RlWP6QOQ8i2pqJ2 arkg== X-Gm-Message-State: AOAM530zgRQBV0ZUK2yEKBe/wwnp4BkJ5xPDIKVClyVGUV6vnBDwVotv LL1BkPyzHSx79SZ/YLuq8U55Sii/I68= X-Google-Smtp-Source: ABdhPJzsVNbKBc/gMtvdpXuXmY/7kshCMIyG6IDl/2goovROvXvauJ2ISNZQb3ajFz0WYtMyp2x5yg== X-Received: by 2002:a5d:498a:: with SMTP id r10mr15770404wrq.106.1604251735813; 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 b136sm11885456wmb.21.2020.11.01.09.28.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Nov 2020 09:28:55 -0800 (PST) Message-Id: <7aca3274d2d25994984cd98f94ed8c3a8411749e.1604251728.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Sun, 01 Nov 2020 17:28:47 +0000 Subject: [PATCH v2 8/8] blame: simplify 'setup_blame_bloom_data' 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 penultimate commit moved the initialization of 'sb.path' in 'builtin/blame.c::cmd_blame' before the call to 'blame.c::setup_blame_bloom_data'. Since 'cmd_blame' is the only caller of 'setup_blame_bloom_data', it is now unnecessary for 'setup_blame_bloom_data' to receive 'path' as a separate argument, as 'sb.path' is already initialized. Remove this argument from setup_blame_bloom_data's interface and use the 'path' field of the 'sb' 'struct blame_scoreboard' instead. Signed-off-by: Philippe Blain --- blame.c | 5 ++--- blame.h | 3 +-- builtin/blame.c | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/blame.c b/blame.c index 128cb7ba55..9042aa3f2b 100644 --- a/blame.c +++ b/blame.c @@ -2887,8 +2887,7 @@ struct blame_entry *blame_entry_prepend(struct blame_entry *head, return new_head; } -void setup_blame_bloom_data(struct blame_scoreboard *sb, - const char *path) +void setup_blame_bloom_data(struct blame_scoreboard *sb) { struct blame_bloom_data *bd; struct bloom_filter_settings *bs; @@ -2908,7 +2907,7 @@ void setup_blame_bloom_data(struct blame_scoreboard *sb, bd->nr = 0; ALLOC_ARRAY(bd->keys, bd->alloc); - add_bloom_key(bd, path); + add_bloom_key(bd, sb->path); sb->bloom_data = bd; } diff --git a/blame.h b/blame.h index e8c185c8ef..38bde535b3 100644 --- a/blame.h +++ b/blame.h @@ -182,8 +182,7 @@ 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, struct blame_origin **orig); -void setup_blame_bloom_data(struct blame_scoreboard *sb, - const char *path); +void setup_blame_bloom_data(struct blame_scoreboard *sb); void cleanup_scoreboard(struct blame_scoreboard *sb); struct blame_entry *blame_entry_prepend(struct blame_entry *head, diff --git a/builtin/blame.c b/builtin/blame.c index 5d8f4c4599..2f8b06e589 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -1092,7 +1092,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix) * for copies. */ if (!(opt & PICKAXE_BLAME_COPY)) - setup_blame_bloom_data(&sb, path); + setup_blame_bloom_data(&sb); lno = sb.num_lines;