From patchwork Fri Oct 22 19:36:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12578965 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E9D4C433FE for ; Fri, 22 Oct 2021 19:36:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0221A610D0 for ; Fri, 22 Oct 2021 19:36:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234135AbhJVTij (ORCPT ); Fri, 22 Oct 2021 15:38:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234043AbhJVTih (ORCPT ); Fri, 22 Oct 2021 15:38:37 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6004BC061764 for ; Fri, 22 Oct 2021 12:36:19 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id d3so2499254wrh.8 for ; Fri, 22 Oct 2021 12:36:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HrZ+zqdE1GX1iIrF4KkIIEJOETMJ/JwZjy212N/Xyno=; b=NLD7ODBePJV9wlb5zdE7FVATn63hwCsjB4VofUwepqnZDI8DqlYT4R7xmNu8Ud6lYf 2o7v15Pp5nlKcsUXj2mXJyAODEpCZXTnD+vc/Uq8mg5RXIjWUO2hQJK3K7Qlaaxh0HaL svu4AexoyQg3o81w8F+69OlbfsK14ukKr2CK8H4C7DF+ZGrbpppkyKNLJlZkUbGTXNsh eVme0wVdLT+DBfBySv83zzDRKLiGgyRxeFcWE6vYDN64NZIObKcUpHE/FF4KHk8UXLWh kTYxiNeia1L2xkz5mvtafGdDAmv6Fi0IRHcYm/ZqOhUPVv1U2DHeIGfPSsYXGv4tAzif 8MsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HrZ+zqdE1GX1iIrF4KkIIEJOETMJ/JwZjy212N/Xyno=; b=1ss7FES6uniX6r7Hystezeopr3z4qNeA5dMp9M4Q6xJngbsmovrwDlCJeI2ls3oYwm ynGnqwRTf3x9PeA5fy/1tAGc4TlwjITWTXEYrxIAY4/qTY61a5Q5N8KZk515l8KRwC7n klyEL6Kp4ga7nxlL2GP0y1QGk40PAs5d7SxdW9gkpiBDPM8IpN4KVBLtl05Svkjondqo eSQA4896tne0nJeq/HDb6XJEWaXU8kFaxnl3kbmebOtufSw1SXBsVzjL7mevkV+kaej4 zFGVFNplx768vL1r8WhpzQHYrNfTUBwDW/tZ/EtkWnTs2FtY6tKGbH2/LAr+o8LZAd7n wEcQ== X-Gm-Message-State: AOAM530XV1qqjXehs9WYw+2zXl1YqWjn2V59pwTX3T3lChpc1hw6l3+j p+aGOz384WgxL66o/VFV+tHmLm+W/rZP6g== X-Google-Smtp-Source: ABdhPJyutyAC+6v8JDWIAQfUH8/TU3twNhAttAv5be1/DFsDgY6MSLw6CmFw8o4OQ30z+69C5AaZ9w== X-Received: by 2002:a5d:67cd:: with SMTP id n13mr2271991wrw.86.1634931377673; Fri, 22 Oct 2021 12:36:17 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id q7sm8871814wrs.73.2021.10.22.12.36.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 12:36:17 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Johannes Sixt , =?utf-8?q?=C3=98ystein_Walle?= , Eric Sunshine , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v2 01/10] command-list.txt: sort with "LC_ALL=C sort" Date: Fri, 22 Oct 2021 21:36:05 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1505.g075a284c562 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org We should keep these files sorted in the C locale, e.g. in the C locale the order is: git-check-mailmap git-check-ref-format git-checkout But under en_US.UTF-8 it's: git-check-mailmap git-checkout git-check-ref-format In a subsequent commit I'll change generate-cmdlist.sh to use C sort order, and without this change we'd be led to believe that that change caused a meaningful change in the output, so let's do this as a separate step, right now the generate-cmdlist.sh script just uses the order found in this file. Signed-off-by: Ævar Arnfjörð Bjarmason --- command-list.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/command-list.txt b/command-list.txt index a289f09ed6f..02fc7ddde68 100644 --- a/command-list.txt +++ b/command-list.txt @@ -60,9 +60,9 @@ git-cat-file plumbinginterrogators git-check-attr purehelpers git-check-ignore purehelpers git-check-mailmap purehelpers +git-check-ref-format purehelpers git-checkout mainporcelain git-checkout-index plumbingmanipulators -git-check-ref-format purehelpers git-cherry plumbinginterrogators complete git-cherry-pick mainporcelain git-citool mainporcelain @@ -111,7 +111,6 @@ git-index-pack plumbingmanipulators git-init mainporcelain init git-instaweb ancillaryinterrogators complete git-interpret-trailers purehelpers -gitk mainporcelain git-log mainporcelain info git-ls-files plumbinginterrogators git-ls-remote plumbinginterrogators @@ -124,11 +123,11 @@ git-merge-base plumbinginterrogators git-merge-file plumbingmanipulators git-merge-index plumbingmanipulators git-merge-one-file purehelpers -git-mergetool ancillarymanipulators complete git-merge-tree ancillaryinterrogators -git-multi-pack-index plumbingmanipulators +git-mergetool ancillarymanipulators complete git-mktag plumbingmanipulators git-mktree plumbingmanipulators +git-multi-pack-index plumbingmanipulators git-mv mainporcelain worktree git-name-rev plumbinginterrogators git-notes mainporcelain @@ -154,23 +153,23 @@ git-request-pull foreignscminterface complete git-rerere ancillaryinterrogators git-reset mainporcelain history git-restore mainporcelain worktree -git-revert mainporcelain git-rev-list plumbinginterrogators git-rev-parse plumbinginterrogators +git-revert mainporcelain git-rm mainporcelain worktree git-send-email foreignscminterface complete git-send-pack synchingrepositories +git-sh-i18n purehelpers +git-sh-setup purehelpers git-shell synchelpers git-shortlog mainporcelain git-show mainporcelain info git-show-branch ancillaryinterrogators complete git-show-index plumbinginterrogators git-show-ref plumbinginterrogators -git-sh-i18n purehelpers -git-sh-setup purehelpers git-sparse-checkout mainporcelain worktree -git-stash mainporcelain git-stage complete +git-stash mainporcelain git-status mainporcelain info git-stripspace purehelpers git-submodule mainporcelain @@ -189,10 +188,11 @@ git-var plumbinginterrogators git-verify-commit ancillaryinterrogators git-verify-pack plumbinginterrogators git-verify-tag ancillaryinterrogators -gitweb ancillaryinterrogators git-whatchanged ancillaryinterrogators complete git-worktree mainporcelain git-write-tree plumbingmanipulators +gitk mainporcelain +gitweb ancillaryinterrogators gitattributes guide gitcli guide gitcore-tutorial guide @@ -211,6 +211,6 @@ gitremote-helpers guide gitrepository-layout guide gitrevisions guide gitsubmodules guide -gittutorial-2 guide gittutorial guide +gittutorial-2 guide gitworkflows guide From patchwork Fri Oct 22 19:36:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12578967 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17F7EC433F5 for ; Fri, 22 Oct 2021 19:36:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F030F61108 for ; Fri, 22 Oct 2021 19:36:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234188AbhJVTin (ORCPT ); Fri, 22 Oct 2021 15:38:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234125AbhJVTii (ORCPT ); Fri, 22 Oct 2021 15:38:38 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60EB0C061767 for ; Fri, 22 Oct 2021 12:36:20 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id m42so3874573wms.2 for ; Fri, 22 Oct 2021 12:36:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dLARhRGoHASyxNBB/aFlcZ/aSXEp5Xya/q+j+8DNzM8=; b=RIJxyXzKIET5DeJQBs8uE2Eevh9XspGjvulpMuqh6zYZ0Os3LPNsBnYK6jC4EbNPg7 hpPtWQYUYAGeO93Z+HGiBxWl6iR2kpiYo/1nRyimFda5XPJ1FQfmEWgYDJIK9qCbkbEI wbDgWM/YOW6auSHUz80AD608ZDQB36rcNjVON7X83MyoWeeH5PWaH6kAAhnsJIKWyecS iK9cFjdEM3ez94PZWaoW7hpyFXCXf2Sszqoq/UsHCDCxYoIrv5pSS98tjrf5HP2OBTA6 t4cXtVNcREeprOpl0Fp849s7Q6HsfR2YQdQnygl/mZ24ghKJpvyfzXG6mivs8f/y8Uw3 gO6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dLARhRGoHASyxNBB/aFlcZ/aSXEp5Xya/q+j+8DNzM8=; b=sJe49p7F2T1oLH96vOruijsdhxHqVxVm7cdXU61B7KykaD2TMdT6tracBK2i7Gwtjc gAl3h+Tm/t5npKyDMoIXhpkcMiZ3T5x/egU2++QSmXEQ3JC7bApEdXjja/rL2NTd0d6N ylwcv7ciSZkfR1/LoAdR7E0zo7uppzPETJUZWaNIsuwQeHw27twEvtg6ecD2FI/bQf0P dB2wqImjqODLEP7crmI1ykRkvOEb9ee+eUaRovPqJDbpdbWnK7NAj1fon4o0Z3h/5+6z dVuj+1vHfwFXTLxPMmSHmiOaeej0Tdx8HUBZc/aMO4JIMwrPXtdfJG5c1VLF4vdHVrl+ f3IQ== X-Gm-Message-State: AOAM531RrWECSFuoNgcWrl/+UxtaU6caET8/MU6cdv5LcAAwe+hlb8pl quiFpNNTkoHLhp8RueBuF4pi3Rdwl4E7mw== X-Google-Smtp-Source: ABdhPJzJHzr+fYjp7vj6E0oM0dgvF0Y/Kc9xjgxMQ2+iRXqU0/RUWQTb1RKxFXM2zmA2oP8412hrEw== X-Received: by 2002:a05:600c:1989:: with SMTP id t9mr1873071wmq.48.1634931378513; Fri, 22 Oct 2021 12:36:18 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id q7sm8871814wrs.73.2021.10.22.12.36.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 12:36:17 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Johannes Sixt , =?utf-8?q?=C3=98ystein_Walle?= , Eric Sunshine , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v2 02/10] generate-cmdlist.sh: trivial whitespace change Date: Fri, 22 Oct 2021 21:36:06 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1505.g075a284c562 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This makes a subsequent diff smaller, and won't leave us with this syntax nit at the end. Signed-off-by: Ævar Arnfjörð Bjarmason --- generate-cmdlist.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh index 9dbbb08e70a..5114f46680a 100755 --- a/generate-cmdlist.sh +++ b/generate-cmdlist.sh @@ -10,7 +10,7 @@ command_list () { } get_categories () { - tr ' ' '\012'| + tr ' ' '\012' | grep -v '^$' | sort | uniq From patchwork Fri Oct 22 19:36:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12578969 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2603CC433FE for ; Fri, 22 Oct 2021 19:36:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 06A28610D0 for ; Fri, 22 Oct 2021 19:36:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234140AbhJVTio (ORCPT ); Fri, 22 Oct 2021 15:38:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234133AbhJVTii (ORCPT ); Fri, 22 Oct 2021 15:38:38 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2ABCC061348 for ; Fri, 22 Oct 2021 12:36:20 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id b189-20020a1c1bc6000000b0030da052dd4fso3277940wmb.3 for ; Fri, 22 Oct 2021 12:36:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=t65+C4evg6aB4+tR0LidQLSIjC4AnEo2Zfu5UMwO3gQ=; b=AajWMQlGN60vTwqUhEtODnbpFFcpZZevWeWJzCX7RjFLuj6YNuDOtZiCdd3RwGcwFk eiBo2TkONbU5BzYdgBY7o/cfNKj1vLyWef7/gGNRk3l4c5F2Sk8LIT6cVtUY1l02XVZG tBDpscglgW8YP6AfbtTeDrA4tzDmQ9ESnfEi6CujYk96NaayExxgx4xHsNJwCTvlEeAL g6Z5ANkwP4kM8baCxE0b0XR++1fde7DVYZrR1mRWDRmbi+FTRwKiBhW9P6MpygQm3lqo n3XNZUgYvDyjMsNPgcSbCx7PeeiWxHkEAIoGXAwtLPqc7EVPCFsi4WsAdkSsiConbWHA v0LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=t65+C4evg6aB4+tR0LidQLSIjC4AnEo2Zfu5UMwO3gQ=; b=dlX4vl2E+26cF1Oqpxu1SwKie8K8U3ubFNLzwTTCQG6qM4AGguvELiM65JRwRTcHH3 o0/1ami3O10Xst6v4rZCzzjlXXdOAxlIWVOvBR7ITWbegvWfUhSgsnu4hOfzl+sIzhmU czmJm0HTxWXTdkxMF/I82Bzk+RHzJs+EfE1+28A5f/HkAvKlvkqyN1UYoJrgSs5WCCWi gybtLc/h0wmqhEoiizH5eA7PSVz4YJXM+poTdMraDjKHYRkY/SaD31I5grGzJDaXqiDw reXHwY3mS+JiavCVDA3RXlqLTsgLkpKj4JUAof3sCZkbrEGn7ZkW9+QKUv58a6Y+95Iy uPyQ== X-Gm-Message-State: AOAM532xu/FTJkgIVcnIj5Rc5rQY9ihgIZEZz1YRBI+y6e1w87R6JoYM RNdhp1HQXmomKaQqLW0Vr444mWo/ec0TbQ== X-Google-Smtp-Source: ABdhPJzLgUnuoqOV6fdVuyCAKg4nqT+lWXKjLEjkq2AG1PyM5uZDKYNZCMV8X1VVBrmxWJDKmC3Muw== X-Received: by 2002:a7b:c199:: with SMTP id y25mr1784213wmi.55.1634931379283; Fri, 22 Oct 2021 12:36:19 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id q7sm8871814wrs.73.2021.10.22.12.36.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 12:36:18 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Johannes Sixt , =?utf-8?q?=C3=98ystein_Walle?= , Eric Sunshine , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v2 03/10] generate-cmdlist.sh: spawn fewer processes Date: Fri, 22 Oct 2021 21:36:07 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1505.g075a284c562 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Sixt The function get_categories() is invoked in a loop over all commands. As it runs several processes, this takes an awful lot of time on Windows. To reduce the number of processes, move the process that filters empty lines to the other invoker of the function, where it is needed. The invocation of get_categories() in the loop does not need the empty line filtered away because the result is word-split by the shell, which eliminates the empty line automatically. Furthermore, use sort -u instead of sort | uniq to remove yet another process. [Ævar: on Linux this seems to speed things up a bit, although with hyperfine(1) the results are fuzzy enough to land within the confidence interval]: $ git show HEAD~:generate-cmdlist.sh >generate-cmdlist.sh.old $ hyperfine --warmup 1 -L s ,.old -p 'make clean' 'sh generate-cmdlist.sh{s} command-list.txt' Benchmark #1: sh generate-cmdlist.sh command-list.txt Time (mean ± σ): 371.3 ms ± 64.2 ms [User: 430.4 ms, System: 72.5 ms] Range (min … max): 320.5 ms … 517.7 ms 10 runs Benchmark #2: sh generate-cmdlist.sh.old command-list.txt Time (mean ± σ): 489.9 ms ± 185.4 ms [User: 724.7 ms, System: 141.3 ms] Range (min … max): 346.0 ms … 885.3 ms 10 runs Summary 'sh generate-cmdlist.sh command-list.txt' ran 1.32 ± 0.55 times faster than 'sh generate-cmdlist.sh.old command-list.txt' Signed-off-by: Johannes Sixt Signed-off-by: Ævar Arnfjörð Bjarmason --- generate-cmdlist.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh index 5114f46680a..27367915611 100755 --- a/generate-cmdlist.sh +++ b/generate-cmdlist.sh @@ -11,15 +11,14 @@ command_list () { get_categories () { tr ' ' '\012' | - grep -v '^$' | - sort | - uniq + LC_ALL=C sort -u } category_list () { command_list "$1" | cut -c 40- | - get_categories + get_categories | + grep -v '^$' } get_synopsis () { From patchwork Fri Oct 22 19:36:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12578971 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 898B7C4332F for ; Fri, 22 Oct 2021 19:36:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6C6D46112D for ; Fri, 22 Oct 2021 19:36:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234147AbhJVTip (ORCPT ); Fri, 22 Oct 2021 15:38:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234137AbhJVTij (ORCPT ); Fri, 22 Oct 2021 15:38:39 -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 A1EFFC061764 for ; Fri, 22 Oct 2021 12:36:21 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id 84-20020a1c0457000000b003232b0f78f8so4648859wme.0 for ; Fri, 22 Oct 2021 12:36:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/48j55kY2mE+sSQaGXhY6fgK7v6zXJHolUpxAUWD5oM=; b=jvv0I2fvc3DoqOM4ZNw3QiA1eAXeB3kmLkbhAkQGNTDar8cI4Q9mbhN6t4HVytY49x Ge+NnqAqZ0EG7BD1fQuIU/9pSoSuajf5swBYoi10ZyuKyUhZ//SsIoWh9e61bvg+MD4a LOJqxlp/kPw69/W28cvhw4R6tApCeqxdDvpDDZBpwd3Z2iqb8mpT0xpRyOHNfqGm4TMq eGPVdZFJ5L7JHMrN3tvzsdPJ3UZ69cSz5k1wCjeJTgQhe78r8fnLqICkdwVF2dXpy7jY Z+HsLeO0PWbKoZte5Hh9VewWrXh+zq2C1spqyN2wqnoO+65ZbuCsILZAtph473LOH7vR 8Vaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/48j55kY2mE+sSQaGXhY6fgK7v6zXJHolUpxAUWD5oM=; b=UA8vJ7BCTkVrfE0CUofa+FlKJtQvfNwb4hmM/6bgw4TeALcz90I/PraEcvw0cMO6OK ZsGrL2f+3GwK/LD9w0bsv7e5/hdA0go00cvhuafmx+nxA7NQNQNwiH1PdDYm+DVj+9dq T/QVdnhpYZ9uiGdPcCfRLoAUDKIJnc45TEN2YJHXE47Q5PuFjshRWQ/Z8xCtxxk4aJlO MdrmJlbeGZxvqE6KpRyGz+WNiLkOlB1KjfG09sRTPmxnKWJmBmd9B+nKI8/o5kfsAuoM nHFNsvr2nlDHV0T5q7jxH9xvatOBhebQZIXN4/E3LxIrHkrXBi4yN2/MIKCd8WO+SEix n6gg== X-Gm-Message-State: AOAM532yviJiSeBNWxnpyxloHorljPrEyw1sJhI2LQg/QMMCDS1t4sFc u6dqwNJ+doiy0ISKf3CSzp0XskbnbH2nXQ== X-Google-Smtp-Source: ABdhPJwhe89Q62X8UbIzd7riaqDdBk1GtIqErqZV3deZHI4nYaTeIZFwMoqJGlFUD3KTQ/c+KfXM/g== X-Received: by 2002:a1c:ac86:: with SMTP id v128mr1797772wme.3.1634931380069; Fri, 22 Oct 2021 12:36:20 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id q7sm8871814wrs.73.2021.10.22.12.36.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 12:36:19 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Johannes Sixt , =?utf-8?q?=C3=98ystein_Walle?= , Eric Sunshine , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v2 04/10] generate-cmdlist.sh: don't call get_categories() from category_list() Date: Fri, 22 Oct 2021 21:36:08 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1505.g075a284c562 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This isn't for optimization as the get_categories() is a purely shell function, but rather for ease of readability, let's just inline these two lines. We'll be changing this code some more in subsequent commits to make this worth it. Rename the get_categories() function to get_category_line(), since that's what it's doing now. Signed-off-by: Ævar Arnfjörð Bjarmason --- generate-cmdlist.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh index 27367915611..16043e38476 100755 --- a/generate-cmdlist.sh +++ b/generate-cmdlist.sh @@ -9,7 +9,7 @@ command_list () { eval "grep -ve '^#' $exclude_programs" <"$1" } -get_categories () { +get_category_line () { tr ' ' '\012' | LC_ALL=C sort -u } @@ -17,7 +17,8 @@ get_categories () { category_list () { command_list "$1" | cut -c 40- | - get_categories | + tr ' ' '\012' | + LC_ALL=C sort -u | grep -v '^$' } @@ -66,7 +67,7 @@ print_command_list () { while read cmd rest do printf " { \"$cmd\", $(get_synopsis $cmd), 0" - for cat in $(echo "$rest" | get_categories) + for cat in $(echo "$rest" | get_category_line) do printf " | CAT_$cat" done From patchwork Fri Oct 22 19:36:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12578973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15D04C433FE for ; Fri, 22 Oct 2021 19:36:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E9CF1610D0 for ; Fri, 22 Oct 2021 19:36:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234211AbhJVTiq (ORCPT ); Fri, 22 Oct 2021 15:38:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234171AbhJVTim (ORCPT ); Fri, 22 Oct 2021 15:38:42 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8159AC061224 for ; Fri, 22 Oct 2021 12:36:22 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id 62-20020a1c0241000000b0032ca21cffeeso2146146wmc.1 for ; Fri, 22 Oct 2021 12:36:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1+Y4dejdbb84XjG3Uf1O1m0X8QhkadkF59FDp5uTi30=; b=NwNQBgsNsJ2uI8zlBy7mHUmOtiE033bRUir+ba8hRIUvGfrqm4nGWgBAay1tPSVREf iSo/cupieHFXyUrodoz30h0nZ00rdTWGYaHOs8aC/z9c5vnSTs4ZKpWKjB/Kox5WNR6o /4BtUycRSKfWnMNRmECbPgwF+S1KRuSZxNx8Vf+r618k5AtFnBAI3Zwts6OD9zXyhz+9 YwLUvCPDsG+7qunoE3YPp4XyzvHeDUz+ATE53blrClT5/upIYrk9hvVE+VD6p/gR2WRU VMWutAPUJKwujBULVm2Zs6mzOMl2NvPsrSYPuXEYBUFBxRn6/Jt1Kg6G4QNDvA1aOzrc Rxww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1+Y4dejdbb84XjG3Uf1O1m0X8QhkadkF59FDp5uTi30=; b=Wu4V425r5iz7enh22+Ja/n5SoncV/lrSEcntUklUMdTpe5mcBPtYTg9v3Iu9mXXQwV QTeJYMwszJCtz+Lbj9VcBnhrzcHiTLyFD9ESiKzY0B7G28zDxya6/squYziP9lyDTR31 8MOGez7ImVnhAdJ5cz1WzrVbp5g0yHo4djY3X838tNck3TYtniohBHusovtaoU3PlPI5 ju2ylGbiPfkIrGDfwxTdwH3AVQPpshTvqsKDk1WeblrW8PH3LehXvyIJhpj0s+xtbgp0 an4O6O8PV1DJETNe/g8JD9DPHrHR+gONWEh961ue6FpdfBavoRhBZJRa8ZPB60EthmSH eCJQ== X-Gm-Message-State: AOAM532qzja1BY8njueraDu6BpW6nosMdflbLldxQocbqPD0M4UXWvwm OqHBupeSITb8kLjR+8uEpXtGLVVW5qLNqg== X-Google-Smtp-Source: ABdhPJwIJEDnTmF9DTXthjay3TSZ6r7cCkD0XrRvbMetmraeOlqqurhoEuPdGIxeiNPhR2pQ45BCsA== X-Received: by 2002:a7b:ce8d:: with SMTP id q13mr30550720wmj.103.1634931380821; Fri, 22 Oct 2021 12:36:20 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id q7sm8871814wrs.73.2021.10.22.12.36.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 12:36:20 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Johannes Sixt , =?utf-8?q?=C3=98ystein_Walle?= , Eric Sunshine , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v2 05/10] generate-cmdlist.sh: run "grep | sort", not "sort | grep" Date: Fri, 22 Oct 2021 21:36:09 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1505.g075a284c562 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This doesn't matter for performance, but let's not include the empty lines in our sorting. This makes the intent of the code clearer. Signed-off-by: Ævar Arnfjörð Bjarmason --- generate-cmdlist.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh index 16043e38476..e517c33710a 100755 --- a/generate-cmdlist.sh +++ b/generate-cmdlist.sh @@ -18,8 +18,8 @@ category_list () { command_list "$1" | cut -c 40- | tr ' ' '\012' | - LC_ALL=C sort -u | - grep -v '^$' + grep -v '^$' | + LC_ALL=C sort -u } get_synopsis () { From patchwork Fri Oct 22 19:36:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12578975 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7784EC433F5 for ; Fri, 22 Oct 2021 19:36:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5EC8F61108 for ; Fri, 22 Oct 2021 19:36:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234163AbhJVTiu (ORCPT ); Fri, 22 Oct 2021 15:38:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232029AbhJVTin (ORCPT ); Fri, 22 Oct 2021 15:38:43 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A315C061226 for ; Fri, 22 Oct 2021 12:36:23 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id m42so3874701wms.2 for ; Fri, 22 Oct 2021 12:36:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m/LYFwkbjkuKt53+fEH9/R5ibanDzRFHAtDpAb5au8w=; b=fydYYV2zZawdBQbY8SgqPXsTv2iQfohpQXBv0v+JyNW2s8DebnWFMshBL18q8CB52O LJSFNF+RmOdJSUDCr+ccABPzKCY863hWGjAWBWohVQszm4F77eLHMQTueoT9FaZTCUq9 +Vc0/3E/QBtzJ+4Jy2fnaPKv3fSn55E269zCwqhlgbgvh1ZvgsJ8KibAKse4ARfEKCJT UJ0aItWPqHIJJkoMr6Sz15OIMuwW2AuU3jHTeuLRbsQ615xB3tfA1qNRsA3lYnNwr32q fI9NqB4PqW5sT0Z96wNtj6GJ/yWKPnbUkziz2DLUewhTTojHc8tn3XldJgDhEFulLDFn RlLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m/LYFwkbjkuKt53+fEH9/R5ibanDzRFHAtDpAb5au8w=; b=0VHaRijYKds449GeZHkp35wnXJU/pPx5o31LZE95yUj6uT1YyvN1HJYZPYHmfaR8GY C5qt59An9AHcIKTEW/s+TwxQlwarjWIb42Hr9xir/pnQcAUNC6asTNlrD/e8VUSyST+s r0me2ptdE0LF5I9K4Bv7iRoxeoq6gXfe44JGWhU4MotWIX601MwBU+vaqT22ow+2WaTt LsKFSRdGmcBLlHc8lwGuebXG1Km/kBI/y7I5XrDK9i9cKIuZoPw+yW5DIb5lWTkT3OLA hSMfvoitY0RQchCvGlg2iL08d9dU/Fff1TZgGp3l633L1mflOmTWF0hrJrMvan0I1Cdv xoBA== X-Gm-Message-State: AOAM533W/Rr62bAndFzsnzycXMKJ6LMl63S4fSz0vZzoXGVBRBqmgxQ9 gzeHXyghb+Us93oKgaNiLKsiQJggq44OSA== X-Google-Smtp-Source: ABdhPJz7TRDcyoEIZ/Ue70hjA/rBCmAwkjArQWbr1Fk7ZnkyzuTuPHm0uafwCBQpii8fV77mQfmTVg== X-Received: by 2002:a1c:a182:: with SMTP id k124mr1877808wme.96.1634931381492; Fri, 22 Oct 2021 12:36:21 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id q7sm8871814wrs.73.2021.10.22.12.36.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 12:36:21 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Johannes Sixt , =?utf-8?q?=C3=98ystein_Walle?= , Eric Sunshine , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v2 06/10] generate-cmdlist.sh: replace for loop by printf's auto-repeat feature Date: Fri, 22 Oct 2021 21:36:10 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1505.g075a284c562 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Sixt This is just a small code reduction. There is a small probability that the new code breaks when the category list is empty. But that would be noticed during the compile step. Signed-off-by: Johannes Sixt Signed-off-by: Ævar Arnfjörð Bjarmason --- generate-cmdlist.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh index e517c33710a..a1ab2b1f077 100755 --- a/generate-cmdlist.sh +++ b/generate-cmdlist.sh @@ -67,10 +67,7 @@ print_command_list () { while read cmd rest do printf " { \"$cmd\", $(get_synopsis $cmd), 0" - for cat in $(echo "$rest" | get_category_line) - do - printf " | CAT_$cat" - done + printf " | CAT_%s" $(echo "$rest" | get_category_line) echo " }," done echo "};" From patchwork Fri Oct 22 19:36:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12578977 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF075C433EF for ; Fri, 22 Oct 2021 19:36:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D8A38610D0 for ; Fri, 22 Oct 2021 19:36:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234206AbhJVTiw (ORCPT ); Fri, 22 Oct 2021 15:38:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234193AbhJVTio (ORCPT ); Fri, 22 Oct 2021 15:38:44 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 264E9C061228 for ; Fri, 22 Oct 2021 12:36:23 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id z11-20020a1c7e0b000000b0030db7b70b6bso4613025wmc.1 for ; Fri, 22 Oct 2021 12:36:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DMNz6q+uy44BismMXZBUBj7Jv2og6z2NKA/VpUkJmrg=; b=cvyUSJvWNyv0RGBwjQ0ijJ9f9+h+clXPd5cX7heZMEzSFzwHeAUIvdaAVxz8sGi3RH Mlvx0b5IX7+NCjcCn2lh3eORwIAdHtMERu6FDnJICUwaIbdyXu73MPYfdpf6fofDVKh3 3BU1Nyy5248oUxTUqMSpAUnhHtw62WNl5h2NJCJfXKZKzsmr9EiyZT8SohN1BFl6sdmH wZq5IgrmxkzGPqolktq3xx6PPmSfPwtAFIoqn2s4rkO4hTMw3kZG8P0DgrXBlkO7WCtM Pu1iMzWog8ZFkqiJS1ADKUwYht38ugKMgMDH6uvg4FSUMMD30+JmQteyCHps9Sph8FvD 5o0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DMNz6q+uy44BismMXZBUBj7Jv2og6z2NKA/VpUkJmrg=; b=Lt+eMfj45pPJlPYKzxu9cSbd60XQTV5DRsMWRxucPvJr4QRMZNIxu16Lq+4exwZtnK sT85hkYMdHsRLK/h2nrQCvSy9sq8/R3+3IxC+HoD3C82RrT8RsIWPgHiBThpfhWSNyU6 ok6hVQca+G9plOoOsWnDzb8/Qux60mz7/QpxmG0X6l8ArbVAvAX9pUm6v9/SefDCL7n3 vS8qS4hDNOuIjeptULeJYUWj08Pbi73APGy5Vtxf/fysFBIW7hUi8oO/wjumg+wWVuHU Jbf1pxUVxR1G9VmGJ6bqv4YzwXkxIpUIpkur1HXL7ZowDuxJrCidjHQL8R4R3dqM8FsT 4gpg== X-Gm-Message-State: AOAM531OtN+Es6IkmHQ4AeBXeGirmAA9CMliL9ObwG9cuFb09sbaBd9+ xT//rrZ9NxfcQauynqdgIMCOuBIAOAH8EA== X-Google-Smtp-Source: ABdhPJxRZej+r3dWyaxKrtg1K/X2awWAkSMPwRJSYniqe7d7lve0wU036lPEQjkGoTFAxHomoRG6oQ== X-Received: by 2002:a1c:f405:: with SMTP id z5mr1899177wma.72.1634931382315; Fri, 22 Oct 2021 12:36:22 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id q7sm8871814wrs.73.2021.10.22.12.36.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 12:36:21 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Johannes Sixt , =?utf-8?q?=C3=98ystein_Walle?= , Eric Sunshine , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v2 07/10] generate-cmdlist.sh: stop sorting category lines Date: Fri, 22 Oct 2021 21:36:11 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1505.g075a284c562 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In a preceding commit we changed the print_command_list() loop to use printf's auto-repeat feature. Let's now get rid of get_category_line() entirely by not sorting the categories. This will change the output of the generated code from e.g.: - { "git-apply", N_("Apply a patch to files and/or to the index"), 0 | CAT_complete | CAT_plumbingmanipulators }, To: + { "git-apply", N_("Apply a patch to files and/or to the index"), 0 | CAT_plumbingmanipulators | CAT_complete }, I.e. the categories are no longer sorted, but as they're OR'd together it won't matter for the end result. This speeds up the generate-cmdlist.sh a bit. Comparing HEAD~ (old) and "master" to this code: 'sh generate-cmdlist.sh command-list.txt' ran 1.07 ± 0.33 times faster than 'sh generate-cmdlist.sh.old command-list.txt' 1.15 ± 0.36 times faster than 'sh generate-cmdlist.sh.master command-list.txt' Suggested-by: Jeff King Signed-off-by: Ævar Arnfjörð Bjarmason --- generate-cmdlist.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh index a1ab2b1f077..f50112c50f8 100755 --- a/generate-cmdlist.sh +++ b/generate-cmdlist.sh @@ -9,11 +9,6 @@ command_list () { eval "grep -ve '^#' $exclude_programs" <"$1" } -get_category_line () { - tr ' ' '\012' | - LC_ALL=C sort -u -} - category_list () { command_list "$1" | cut -c 40- | @@ -67,7 +62,7 @@ print_command_list () { while read cmd rest do printf " { \"$cmd\", $(get_synopsis $cmd), 0" - printf " | CAT_%s" $(echo "$rest" | get_category_line) + printf " | CAT_%s" $rest echo " }," done echo "};" From patchwork Fri Oct 22 19:36:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12578979 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6CB7C433F5 for ; Fri, 22 Oct 2021 19:36:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9FDDD610FF for ; Fri, 22 Oct 2021 19:36:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234227AbhJVTi4 (ORCPT ); Fri, 22 Oct 2021 15:38:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234125AbhJVTio (ORCPT ); Fri, 22 Oct 2021 15:38:44 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF770C06122A for ; Fri, 22 Oct 2021 12:36:24 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id e12so20786wra.4 for ; Fri, 22 Oct 2021 12:36:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pF4GBms6PE4O5l10FOHXxaZ5qkF2CdBliJtOD1kcQNI=; b=aLLYO2bNJdp6huZ3A59F3N0rGKSo6LhJfok7DH4CWMCGzQTODBIioC84Z8hfpKs3Ka pQo/nO2IHExq2q3MuPPaoEwZgqTX2t6u9P3MTC5tGoaYkbGienho3OJlo5SuW3K34xQ0 Nn6rfTGItIWEimO9NrkjcFJ3L8WnoUO7iQLNi224d6JH1JEq/+PiSDnhqbHdMAKjG763 3ZhTyJgPebg4lxt4pOfTGACYelVhhtqmtIJoi1He/CXxyaLiAQHNOmBhmzJ19Lvo4Cgn xEPqwCnYNuil3CQ3swLQQvoeYdI9s+q9zfCW/PVd6suDCEIGqCKjCOXGStIghO7AE6RQ +89Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pF4GBms6PE4O5l10FOHXxaZ5qkF2CdBliJtOD1kcQNI=; b=sES4e1RUY9/LTL6ePSU9adxf3ZjokGd4uTP/A+cCiAkKHhqNcOCCqnyCNgAoZ9DVRF 3FwX2FtVQ+3vLGvKdjy/SJ9qE0u6Zah+vOwdA0QdtfpmojvfXIjOgSwAAgBjNYrcQZPC lP4Rt5sKNIMO3bH+XKQyMh4cYwGGUMJNOPw2cNYPN0gONlxHx6LGquek/eD61TmlDnyn KOrY7ViHKQssg8nKdmO14djqP3BVShR1RstjUb1mc4RAxgQnpUN7W5xaD5M2U7PATE1z wGrkGbMo951j5cti/Y52oYsdw5WW5pOlw5YCVXwxh63/fuW2hfkcb2jdpRm96JBHcDQN aTZg== X-Gm-Message-State: AOAM5312zR1nJCJZOaKWydtgYqw8FncHKLfye+MZvdiF46eYB2GLP+D4 RL0bqQs6DesyTO3IW2tRymjJ9XXDPYPRjg== X-Google-Smtp-Source: ABdhPJyMvuCCnddL/aBviNrmZ9YTjLzZattzuZS9T+O+xGxmFe1aWtbQbqpVpQU9sMwubwXP5ZS3Mg== X-Received: by 2002:a5d:6501:: with SMTP id x1mr2231842wru.77.1634931383162; Fri, 22 Oct 2021 12:36:23 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id q7sm8871814wrs.73.2021.10.22.12.36.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 12:36:22 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Johannes Sixt , =?utf-8?q?=C3=98ystein_Walle?= , Eric Sunshine , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v2 08/10] generate-cmdlist.sh: do not shell out to "sed" Date: Fri, 22 Oct 2021 21:36:12 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1505.g075a284c562 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jeff King Replace the "sed" invocation in get_synopsis() with a pure-shell version. This speeds up generate-cmdlist.sh significantly. Compared to HEAD~ (old) and "master" we are, according to hyperfine(1): 'sh generate-cmdlist.sh command-list.txt' ran 12.69 ± 5.01 times faster than 'sh generate-cmdlist.sh.old command-list.txt' 18.34 ± 3.03 times faster than 'sh generate-cmdlist.sh.master command-list.txt' Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Jeff King --- generate-cmdlist.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh index f50112c50f8..9b7d6aea629 100755 --- a/generate-cmdlist.sh +++ b/generate-cmdlist.sh @@ -17,16 +17,6 @@ category_list () { LC_ALL=C sort -u } -get_synopsis () { - sed -n ' - /^NAME/,/'"$1"'/H - ${ - x - s/.*'"$1"' - \(.*\)/N_("\1")/ - p - }' "Documentation/$1.txt" -} - define_categories () { echo echo "/* Command categories */" @@ -61,7 +51,18 @@ print_command_list () { command_list "$1" | while read cmd rest do - printf " { \"$cmd\", $(get_synopsis $cmd), 0" + synopsis= + while read line + do + case "$line" in + "$cmd - "*) + synopsis=${line#$cmd - } + break + ;; + esac + done <"Documentation/$cmd.txt" + + printf '\t{ "%s", N_("%s"), 0' "$cmd" "$synopsis" printf " | CAT_%s" $rest echo " }," done From patchwork Fri Oct 22 19:36:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12578983 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 379DDC433EF for ; Fri, 22 Oct 2021 19:36:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 21C5E610D0 for ; Fri, 22 Oct 2021 19:36:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234251AbhJVTjA (ORCPT ); Fri, 22 Oct 2021 15:39:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234203AbhJVTio (ORCPT ); Fri, 22 Oct 2021 15:38:44 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90445C061229 for ; Fri, 22 Oct 2021 12:36:25 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id g141so3862559wmg.4 for ; Fri, 22 Oct 2021 12:36:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bsMfxwpE3eZAW54R1YCG18IgQpzFZRpihiEB3XUhBOY=; b=TxKFZP+vzDqN/RV828dsq8jGgdF1VjapDIa/ThD64cHoYIaJ5DyrxWelqI+CI9EpVj /H18XacmPQKtaFML0eKx1wibNU+W9wlVS4q8vDQ7OpoYeP/iaTuxlf/gprNyn65J9UmP KIJ5lqikbhDpoBPM+gcdzFDP+GA5gvpZvb+wipEiheP3iSF8RhTjM2tFxicjCKL9eUvf y0i43RTW7sLMywR/I7b3AYvwiGe3YlxJnl+MUY6mgaxWSbdYOiO5WxmLjoNkZZXW+mmb ZjG1PI5Ic3S0VqFmPg9J6QFYPGOWl2wqlHRUaK0qdF3n7vBitLFY4nbi4ShaldqFs3zy ZaNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bsMfxwpE3eZAW54R1YCG18IgQpzFZRpihiEB3XUhBOY=; b=Nhx3dkmqS8IRtsUVnVMWzRy1+hMUSLSFCnHEL+DqXkYUIQdHGMYupkdbEY0iUf/gch kcOSw6bRlSJ8VHTbs6AqK/gVLFJIr2RkAPyS3RKJmcbd2EEbTFloDlsS7OniC3g//m5B XwLaZuza1Sf1NUU2PF/M2ZjqUIl+8wD1hG6GGIBvZhLksWunCKxayr2+kxYcWKj6Oouk SUq/T3rs1VTht8pAIZtGj2K/waO9fqRTerpIiWWYNbcvzDW84ZUEniTz5p0otsi9JabN ulz/kdHDeIjs+ZGqrz9Euyj3k4JpIg4wuVFzNgwlfO+RrpBZKKOXvU/KofWVDE1TcGxW EJtg== X-Gm-Message-State: AOAM5308xINJu+EzW+eISlbo51Hhoft5lWK5b/UG8snZrea974gY0Qys mlU59xDs1yuqDwthDMf73NcLmHE/ZsKP8A== X-Google-Smtp-Source: ABdhPJzW8EwGqv29YOjypyYsNWco2ET5KZYkHkDVB/NyC0RsHKsP9SPyPm6kkB3kMn9UT5QtbrltUQ== X-Received: by 2002:a1c:7e87:: with SMTP id z129mr1803006wmc.75.1634931383915; Fri, 22 Oct 2021 12:36:23 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id q7sm8871814wrs.73.2021.10.22.12.36.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 12:36:23 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Johannes Sixt , =?utf-8?q?=C3=98ystein_Walle?= , Eric Sunshine , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v2 09/10] generate-cmdlist.sh: replace "grep' invocation with a shell version Date: Fri, 22 Oct 2021 21:36:13 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1505.g075a284c562 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Replace the "grep" we run to exclude certain programs from the generated output with a pure-shell loop that strips out the comments, and sees if the "cmd" we're reading is on a list of excluded programs. This uses a trick similar to test_have_prereq() in test-lib-functions.sh. On my *nix system this makes things quite a bit slower compared to HEAD~, but since the generate-cmdlist.sh is already quite fast, and this likely helps systems where command invocations are more expensive (i.e. Windows) let's use this anyway. 'sh generate-cmdlist.sh.old command-list.txt' ran 1.56 ± 0.11 times faster than 'sh generate-cmdlist.sh command-list.txt' 18.00 ± 0.19 times faster than 'sh generate-cmdlist.sh.master command-list.txt' Signed-off-by: Ævar Arnfjörð Bjarmason --- generate-cmdlist.sh | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh index 9b7d6aea629..2b184bbc65f 100755 --- a/generate-cmdlist.sh +++ b/generate-cmdlist.sh @@ -6,12 +6,27 @@ die () { } command_list () { - eval "grep -ve '^#' $exclude_programs" <"$1" + while read cmd rest + do + case "$cmd" in + "#"*) + continue; + ;; + *) + case "$exclude_programs" in + *":$cmd:"*) + ;; + *) + echo "$cmd $rest" + ;; + esac + esac + done } category_list () { - command_list "$1" | - cut -c 40- | + command_list <"$1" | + cut -d' ' -f2- | tr ' ' '\012' | grep -v '^$' | LC_ALL=C sort -u @@ -48,7 +63,7 @@ define_category_names () { print_command_list () { echo "static struct cmdname_help command_list[] = {" - command_list "$1" | + command_list <"$1" | while read cmd rest do synopsis= @@ -69,11 +84,11 @@ print_command_list () { echo "};" } -exclude_programs= +exclude_programs=: while test "--exclude-program" = "$1" do shift - exclude_programs="$exclude_programs -e \"^$1 \"" + exclude_programs="$exclude_programs$1:" shift done From patchwork Fri Oct 22 19:36:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12578981 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0AA5C433F5 for ; Fri, 22 Oct 2021 19:36:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 99D2861108 for ; Fri, 22 Oct 2021 19:36:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234294AbhJVTi5 (ORCPT ); Fri, 22 Oct 2021 15:38:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234043AbhJVTio (ORCPT ); Fri, 22 Oct 2021 15:38:44 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BBC4C061764 for ; Fri, 22 Oct 2021 12:36:26 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id r7so3858415wrc.10 for ; Fri, 22 Oct 2021 12:36:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kmBk057MADwf3Hiz0M6RNSfV69uEK+bbWEu36CyNcyk=; b=mEuBE9SST+kgnIpyfPbNqfPFV1GV5GcaC2+FMDhBCdB7amKDF+Zm6Walu6i0SGu7KC du968fZYGa8Xl5qZrZkKOhVxl8YDO/RFkdL4d8IixMswIBu2EHcxm0qtA2ffv0zPixUM PiosNRD/AzEp5HHgw0DrKGkR258Xwt6fMQYq3CBjjEg/i9BU6+kaUd8IPjj4Fi3e/OdS ztoXn6BhVX781M4KXH7YnLLH6vFx/NpEe4fsTP2Lsq63EN5DhNfrtXWyhEr/jaI/FXdd TUbKwmaCBHSg5LGtfC+PBZUxausDcQ9MiWMlnBDs4xkVAjOkvfpALX0chbMLul19her/ 5EQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kmBk057MADwf3Hiz0M6RNSfV69uEK+bbWEu36CyNcyk=; b=R94YiVW7NZMEnTpfJC9CndTH44lr9177fwXZCmfFZSLUkbvLpcSjOHUR9Cn96Vy+t9 QJSJbg9cWfgB5Ye+0jgtKzkPvNxqiYCLd7aht7JTrjxhha7dozP8iNZjsyqxwZcmHZ+3 pUrOtDSxdFQtKNawYiZKpMKZpcGi6LugSQFO5GaAGucIDygBoQ7GCbt9w3W3n2dsk04s 63zxs30XRp4pRGPW5Cyyqx0zMsx7Ky74nLYU4G/R8ZTTcUoq7W2vSeHgQ9ZYXDoFVwhj rjellJmIqu8WnghhgzWHKtUPawBt3D+m2WqwreVYQgykIgoCLjy0e6ZFl6kgCi7AdjyU bC+w== X-Gm-Message-State: AOAM532Ih5WcSlzL3aCODRMj4QlbFcMa0mvJFJ/f9U1Q5DBgT9cZ+5bV aBGbe3TgK+PC9Z38eapDusAIdosjhGhaBA== X-Google-Smtp-Source: ABdhPJyDIPpuL0yFyHU4emgMboBIu6WfOIq5z6MszLQoVXedC2t9IALa+Pb6qzj4Ug1HsSjzi5oQDA== X-Received: by 2002:adf:a486:: with SMTP id g6mr2242007wrb.130.1634931384845; Fri, 22 Oct 2021 12:36:24 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id q7sm8871814wrs.73.2021.10.22.12.36.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 12:36:24 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Jeff King , Johannes Sixt , =?utf-8?q?=C3=98ystein_Walle?= , Eric Sunshine , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH v2 10/10] generate-cmdlist.sh: replace "cut", "tr" and "grep" with pure-shell Date: Fri, 22 Oct 2021 21:36:14 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1505.g075a284c562 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Extend the pure-shell parsing of command-list.txt by using having command_list() take an argument indicating whether we're interested in the "$cmd" part of the line, or just the "$rest". That takes care of the "cut -d", and printf's auto-repeat feature can replace the "tr". We don't need the "grep -v" either, as we're not emitting any empty lines here (the command-list.txt doesn't have any). This doesn't make things any faster or slower in my tests, but as with the preceding commit let's do it just to get rid of command invocations, it'll probably help on e.g. Windows. Signed-off-by: Ævar Arnfjörð Bjarmason --- generate-cmdlist.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh index 2b184bbc65f..394443c66df 100755 --- a/generate-cmdlist.sh +++ b/generate-cmdlist.sh @@ -17,7 +17,12 @@ command_list () { *":$cmd:"*) ;; *) - echo "$cmd $rest" + if test -n "$1" + then + printf "%s\n" $rest + else + echo "$cmd $rest" + fi ;; esac esac @@ -25,10 +30,7 @@ command_list () { } category_list () { - command_list <"$1" | - cut -d' ' -f2- | - tr ' ' '\012' | - grep -v '^$' | + command_list --no-cat <"$1" | LC_ALL=C sort -u }