From patchwork Wed Oct 20 18:39:52 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: 12573015 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 5EFD8C433F5 for ; Wed, 20 Oct 2021 18:40:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B5D9610D0 for ; Wed, 20 Oct 2021 18:40:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231278AbhJTSmT (ORCPT ); Wed, 20 Oct 2021 14:42:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230325AbhJTSmT (ORCPT ); Wed, 20 Oct 2021 14:42:19 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64555C06161C for ; Wed, 20 Oct 2021 11:40:04 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id 67-20020a1c1946000000b0030d4c90fa87so11910799wmz.2 for ; Wed, 20 Oct 2021 11:40:04 -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=/+NlfgSggbTOh4a6IVt8gFJfdmgwqFT/2H0t+yDDwu4=; b=TwOSjWTFv8rN3EATIGttZM6J0idAhvdyeSf2yPYc/AMX+MUTZPnkXHrf8WbDSn+IZR 0l+wTccvn74bPWdi0+x0afT+K3KL9q3CLkOs56dXzBNDpW1j+PMNzJMwfAymg1KFu7Pn dMCeQMQi8MxrSXNvlAI+UyZxgvI3zkr5oJQhhOuSuD1L8J5Fg6NgM+u/c/fIM/5xjOPT cW7X6gGU5Lo2FDjyNsVHPCF+PtGCfZ4MkLnh3Ngm7ng2AVeN86Gvc0+vHxqpVGbIwBIB 6t4P3X3t/7mJUpNgBYyl1394kXeLcaqn72ZJdVtm6KGlAOmlsqToNyFbjb5EEIubRYnN VjtA== 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=/+NlfgSggbTOh4a6IVt8gFJfdmgwqFT/2H0t+yDDwu4=; b=GxU7NZXZdJJaMLizWIDYT72IPjHb/kAR2CQIEjaznHIdWk2GtvkI+ZB+EZ31bWGbIW 09mgOTh8BiJ8s09oKQ90nExzuDJkhzaf6anCzQ9x/1+lgxOVMNuMeEeXbJPtmxpQjaLu AAPzzk3GCyhDU94D9QGwZuvH28+bwZ7VaUlRhxDatXzabTPrFRJG3+MZcKpjTxNnOmdp RwsgsjlFD6gjZYdjnuRo4QTORS/UTeCFXnLS/6ep9u85kPOaSZVFTU2DTkBMWryUzzi6 P3MrqenT8RxckiNZEoyoeYmGg+TB7TfPTWK0b1kE89nNyqiV4QHd9HUoguriNVe2D7GX gkAw== X-Gm-Message-State: AOAM533hVLsJJedB1+F+UCId59kKGK8RCMqFNhHtpD4uNwvnpFSUSmkl VyzZ7aeQICNCcBTen/M52AgGBkrXzLCewQ== X-Google-Smtp-Source: ABdhPJy/XX4No9mm2UQpdKtbsEmf5CvXRjHRrGtWxjspSdKFzR4g4D1ZY7lQVlV5vN0Fp4GOjZD8TQ== X-Received: by 2002:a05:600c:218d:: with SMTP id e13mr1070586wme.130.1634755202702; Wed, 20 Oct 2021 11:40:02 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id d8sm2813835wrv.80.2021.10.20.11.40.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 11:40:02 -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?= , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 1/8] command-list.txt: sort with "LC_ALL=C sort" Date: Wed, 20 Oct 2021 20:39:52 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1338.g20da966911a 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 Wed Oct 20 18:39:53 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: 12573017 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 D33F3C433FE for ; Wed, 20 Oct 2021 18:40:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B6EFB610D0 for ; Wed, 20 Oct 2021 18:40:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231292AbhJTSmV (ORCPT ); Wed, 20 Oct 2021 14:42:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230325AbhJTSmU (ORCPT ); Wed, 20 Oct 2021 14:42:20 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72A42C06161C for ; Wed, 20 Oct 2021 11:40:05 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id g25so330155wrb.2 for ; Wed, 20 Oct 2021 11:40:05 -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=W6EUYiqjbThAGB97XzJsl7LDwbgwXrXjrbwr96okR6Y=; b=Dljw5jozsqnBccvZDZBiJbFdUMIxU89qYUxYmB2sFmp4IpZVc2hfgObDSsxuwO4UMR Q6RZmosDKynA31I/ZnVW8XzmInEzW0XOf/pXOsb8DHZr5Nzo9EZwnpc/bswNj8uE/g90 Chit9z6V8nRUOsplHKsEX0OkcyDh4zsg5DBxtJlbhbRtzUBpivC0jmWREmo2VT4es09Q DBljFn/dD/6rukPGpkiut5BZiIUh/fEkH7jsqr2WsiR/8OnuqPPvWWdbrO0xFdlNy0nh Ryy4TV/4YYIbAiFhcTm/e0pcKCQDCidnbeGZyTymZJnaqQSNc4/pnsULjce8jWMKAKON j7Vw== 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=W6EUYiqjbThAGB97XzJsl7LDwbgwXrXjrbwr96okR6Y=; b=2YC5nPjO242eP89YHwEEFC0YTj0x5ngv9oQwblvU6rdM3NG3dv9eN4hLeXvL28Y6Nm gRKxX5f7uovR9s9BV8NJ3WpDSGYQhGuIKwLLDp1Vvn5sdioMFIBQ2c/BEyDz/iZoydb9 qxBARNrbZVOAE++IMPb2yVbDT2hBrXZe5/sSijPeFfcKOLTyG2xXZUfhCTNgNr09qfgK QBrQ5RJld2FZSoGJevvC3pnRLjpOZyhBdn4AzKIz5GJEPqsgnVY/eHdRqXCmB8yYHCYv bZN0iMDXODhxs5g76jcMGwf3LhfhrlHGoql+DVGSAQoIFcHVKyZDsKVORo+AmzKmFdmT Ey/A== X-Gm-Message-State: AOAM533CRHKqpQ6vpc46AE5dXM0huwnOK5OyczLdC/dJwtNqbD8/8Aiz hoKCaRMCSBJXeUMtO1CQ7a0PyECcAJxNAA== X-Google-Smtp-Source: ABdhPJzb6abw/+QABBHdKyRfEbH5733ZqwAN7l2x3e2UoHd90GaO+A5gTQXhB54pSCM6xQDxd/dgVQ== X-Received: by 2002:adf:b19c:: with SMTP id q28mr1136198wra.348.1634755203588; Wed, 20 Oct 2021 11:40:03 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id d8sm2813835wrv.80.2021.10.20.11.40.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 11:40:02 -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?= , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 2/8] generate-cmdlist.sh: trivial whitespace change Date: Wed, 20 Oct 2021 20:39:53 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1338.g20da966911a 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 Wed Oct 20 18:39:54 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: 12573019 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 9450EC433EF for ; Wed, 20 Oct 2021 18:40:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7C194610D0 for ; Wed, 20 Oct 2021 18:40:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231298AbhJTSmX (ORCPT ); Wed, 20 Oct 2021 14:42:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231293AbhJTSmV (ORCPT ); Wed, 20 Oct 2021 14:42:21 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E609C06161C for ; Wed, 20 Oct 2021 11:40:06 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id e12so198025wra.4 for ; Wed, 20 Oct 2021 11:40:06 -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=qZ6JRiQL3N/PzUvDAXxR5kFqKHWDmOsT8kp1tgOJClc=; b=qgugUdXszZGFTHZwOVf9jwgK3gN9HThXqjxAa7klnnl5wSUoPgRftUHKU86YQ+OrKT N5q+d65i1b5zTSXbZ6bqKRjn6fUUQcusGxZduhjyk0cEojbqPeHAGda45ItV5qLP5t8K ORfNms9lv6QO21W18WeNuVzb9O367bbsij7LDGtu5eqb47iqa/iZAJIWBF0OeiQvuzQ2 jrCbAwjXsr7EG3nnNeQ4lTvZbiHQTbCoaRivu9mAVwT5N4GvWX42gBp9LH+92wWAlqp2 7oJijcDbK4UR89/SXdoxoE5xVWXP3ZeHtf/gxOR9gl6/VHmtIqdh+fsqdSKYtJ+soldh wwDA== 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=qZ6JRiQL3N/PzUvDAXxR5kFqKHWDmOsT8kp1tgOJClc=; b=CiQ0BKRf0cR6NPLL6okI8XbVu5DEg+6GeCq3+utjfKoVMZZ/jIruio/UzI9EMYEqWp awjGnAfc3IFlfyZxYh+x7gVAyv7fP14uoqEC9NpEkP13BuNam+5+fcRJtPL9GGu/ETQ/ XzLxKscDn+qxVc84y51SF9ShNyjTSejwe83gnMrlJwUvqZGqkbBNGoJfZbXqVpILSDaN Py22799tO9+nh0M7wnGXr9cRC0vDqLbKbaZ2xC9XE72t7OmQt8qyyIXnFlWINaMzr2Iz ibQTkY5264qY0e0L3ocsr5QH/DfoPH5173M2PNm3rA70pBFAEQxbgVWYHkaLwUWinrWI 3ZPw== X-Gm-Message-State: AOAM5311p+AU/DsAuE5X19oVZYD/6ZYNNCMKYz7BTmhHUTKumWH2apSI Kk+n2LBeNOvZd29CNU3dGalKferBpl2EAA== X-Google-Smtp-Source: ABdhPJxAIpvtGawU0AYKXgDvfsuk8lOrMTV1kbqyDbGtwZIO5zzcoRnQ/jXh4z2L6VftjTH+GqkBCQ== X-Received: by 2002:adf:bb88:: with SMTP id q8mr1124973wrg.390.1634755204742; Wed, 20 Oct 2021 11:40:04 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id d8sm2813835wrv.80.2021.10.20.11.40.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 11:40:03 -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?= , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 3/8] generate-cmdlist.sh: spawn fewer processes Date: Wed, 20 Oct 2021 20:39:54 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1338.g20da966911a 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 Wed Oct 20 18:39:55 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: 12573021 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 55BD3C433F5 for ; Wed, 20 Oct 2021 18:40:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3CBF561212 for ; Wed, 20 Oct 2021 18:40:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231294AbhJTSmX (ORCPT ); Wed, 20 Oct 2021 14:42:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230325AbhJTSmW (ORCPT ); Wed, 20 Oct 2021 14:42:22 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DDC8C061749 for ; Wed, 20 Oct 2021 11:40:07 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id m22so311175wrb.0 for ; Wed, 20 Oct 2021 11:40:07 -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=20vmWMe51PejznLwjOmf0gpSyzewLrJ4KUREjYfruwA=; b=cWwUrYWQrDq6+tEL/R28soOc3PvRx4E66DUuTEnOxM5qAdkdbAfAj0aCMYTh6xOyzN TN928iKcV7hSKeTsjds4eHriZEEgJ6/qGKJxc+oTTgMvt4nU+y3HlIeEG+Pw7IU6j5oe YtR5aO/uTpXjhSKHmnIIGE+nZuAR7aIHy9kxN6UgSH2EIVQAKN57K25pZDrKTdJ5D3ic 34I4AvLzpMkzdIEFt8BAjhEevlnErOWaxE/KXpZ9waJLwNt0U3t/186JyMW/esDpOA41 Ngv4lB0oGipxWSKcI6u7TUoB4cI9keg2d9xYCTjdvwJro1qXKK1hOYG6L5f3hBCr5edB z/Rw== 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=20vmWMe51PejznLwjOmf0gpSyzewLrJ4KUREjYfruwA=; b=UtEhI9HFKwAKOaKnilk8hEOD5DPsesMSunTUDVBr/OprB7toXy5pncafdjHpNJZnmy m6pxJfbUB7Acrgx32ROzDzMut85CkMv+9sHviJpdGjr1wywf9ZYF0ANf4M0S8T6NjOCL FYls7prS5err9Ai/fyPwfXzzZn9Ma2MocDQPG6x6UyKuoi9AhJ4uar/ZfxuMmKmOr14r 2LikRZg5f1ZyVLQ4qrpfIU9mBsBEDRsNbJk87sBb7QG+S2zYaPs9ASHtH6eVfemB6m3m cimEG46GEqGpfMLQ8ZKqvKOQbODp1bgejJwJDuM3J5ksfCFvWU7Z6F940HgqVr52s/ut slyQ== X-Gm-Message-State: AOAM533ORcbHzHAxHcj9ZDhYisqb/Vxs0nJ7V03Aq8gkd8h5aYGidIzk Ls7wsizHLlsxMTM1iboVA4oT2OTCnJdlfA== X-Google-Smtp-Source: ABdhPJyrVRUAcFo3kbOPQpKmNKfPjSszIDAqZQCh4e2aY8u0c6Sd3eaI3eNYqSr/fit2oYsjUG23XQ== X-Received: by 2002:adf:bb09:: with SMTP id r9mr1167379wrg.238.1634755205720; Wed, 20 Oct 2021 11:40:05 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id d8sm2813835wrv.80.2021.10.20.11.40.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 11:40:04 -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?= , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 4/8] generate-cmdlist.sh: don't call get_categories() from category_list() Date: Wed, 20 Oct 2021 20:39:55 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1338.g20da966911a 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 Wed Oct 20 18:39:56 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: 12573023 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 E066DC433EF for ; Wed, 20 Oct 2021 18:40:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CDADC610E7 for ; Wed, 20 Oct 2021 18:40:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231313AbhJTSmZ (ORCPT ); Wed, 20 Oct 2021 14:42:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230325AbhJTSmY (ORCPT ); Wed, 20 Oct 2021 14:42:24 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64A5CC06161C for ; Wed, 20 Oct 2021 11:40:09 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id v17so48690013wrv.9 for ; Wed, 20 Oct 2021 11:40:09 -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=I57eDR0vh7itp2g+J8ZnlFkiookKOb82IZhHC0cAUf0=; b=ONccZcgx1K3Eo5rPsV+FDhNISzzOdghIW3oO5mnyCPz1BnDwoXJpoiLSjZsMtApShl Xj3DVEZXpFk9reLXp1pNGsJjco8RfSIRUOSgLmGixoZCfF1At3+U4fWEViDwBYo8PKSx a09kKkeDbb6XLRl433wrX3A7CxDfwEtXixpqCPGo9wq8x968bKPjV+ekYfnxiFen+3Qd jdptW8a+9YnyJAUhU53MdTH+0wPTyK4eI8nHlEE0LQ0dQnG+znAy4Q6kGGyZxtVLcLD8 UAo3K87Dsb5tDZ4gW2d/zcG0h4fk11o3m/ASWgcYhaNFIIdaC7sgQcNxc5q8yDQZJmmH 7zkg== 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=I57eDR0vh7itp2g+J8ZnlFkiookKOb82IZhHC0cAUf0=; b=nqfftIz0VpaFCOa2/EV2oz/cQtZYjUxpMS8wSsp9J64xtCR/gxmKXuLYr8Vr5sy1Ki 8sWhWi004G5VoqLbiXDmxao8D6uUWsOt6CJiP441KL6/njCGJ3ZdBDBsFVQJOlOqFiVJ hwZFXWDhgpTMsMd/M7la/Q8Hf3NyFxI0FMawlrtpWB9EgjMinSaacDrTk/FGHl2gEuee AQ4+HBYq0elyHnWt/JzXTh/KF6PupWj66LXKm6ezMXl2k+8Vy2/lsPM7T/P10rRHHD63 dZ4Z08i9UZnOdqvdZZDdOGBlcOfvJzyrV8TuFQi8aFYTho3T2icLiYLzLUFqJAPQXo5h PnHQ== X-Gm-Message-State: AOAM5331Ez0UBEMGhZb7R2ZMFP8Nxnvu7ujyIMQ1UJNbN8xByQtZ0lJc lCkk5p6GAHe7+uh4U5yx8A5ENPUrsvjifA== X-Google-Smtp-Source: ABdhPJynzEXjEJocOIcwnIzsWrdoAQMy+0eyM6TBQsnF4jJyjJlhT1vSIgB2sOtQG9NpnNUnH1poTA== X-Received: by 2002:a5d:5703:: with SMTP id a3mr129568wrv.372.1634755207319; Wed, 20 Oct 2021 11:40:07 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id d8sm2813835wrv.80.2021.10.20.11.40.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 11:40:05 -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?= , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 5/8] generate-cmdlist.sh: run "grep | sort", not "sort | grep" Date: Wed, 20 Oct 2021 20:39:56 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1338.g20da966911a 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 Wed Oct 20 18:39:57 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: 12573025 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 BD9B2C433EF for ; Wed, 20 Oct 2021 18:40:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9DBB0610E7 for ; Wed, 20 Oct 2021 18:40:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231331AbhJTSm1 (ORCPT ); Wed, 20 Oct 2021 14:42:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231310AbhJTSmZ (ORCPT ); Wed, 20 Oct 2021 14:42:25 -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 6B007C06161C for ; Wed, 20 Oct 2021 11:40:10 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id u18so308354wrg.5 for ; Wed, 20 Oct 2021 11:40:10 -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=vQD3CMDfIeH/mwS1ngP0BuQ7NtSnurP6XeD0kmpdUko=; b=LEjLdzSK2zmoH+zeC9enyKffb5GMcUZ1ii2hTiEdl88WLFQCw0Vt+qB41vCHrs7D5B n2vPm6tt+1rHlF6xpatvBBPs703J0ZRAxJNJE6U0AENO5KF7Ecl5cGA32eW+RhDbBogl iucDb2IGw9md3n/5DGgTlNMwZ1DUz1j7S/B6r9FsVUO93XPFI7utfABUcUiuB/ZOerVH lyMrxdtOuyq49PPZyDPc24/QDm+2zdk6tUyf7YIluLNnGE1eAVYUq9WTXQ3o6AIE1vPM tYu3XY5ZuJV3djQPAet8lCIOgdEmjkCwc0WrKoUPCjklF+A8LOwbIw7yoXZ6PkiF2TQx 3SBA== 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=vQD3CMDfIeH/mwS1ngP0BuQ7NtSnurP6XeD0kmpdUko=; b=TuoDzPLnf35I51V7Q/3NgOXYTA5qLI/hPSHjjsf7FK4za8XfZs3L+mefFEkiTG417n jPDiHzCov8Jv933M3Qu4Rf1K6yt9vwABUNkvYz6s/eMzgl3kVYVKT8yMW0OuLTZ+66y7 9cv6097pXNXMkalPwiH6p3y9CwJFyEYdBHh+3CjXoY/b0oOn7CLka3YozpsOk8nv+Cbi n/8gRPJItvb0G/cAVaIJF1IA7PAw3KQO+HftwTx0o7HI1ZyIqKxer7+p8G2aZXCWoxJP 6Vwh4G6qllvxEvb4PacmvJHSO6EB2p87Trpf29Di0zTjveTnFKi5uEy9W3dzZe6CcsML GYjQ== X-Gm-Message-State: AOAM532dHVdrszdN7g9gwEDeDOSVeZ3dSeQR5mmPpuJvOHROzpdMcHG4 Z2Wvx6H0wP9ypwuTTvu98Rh6b4L1dHwyZw== X-Google-Smtp-Source: ABdhPJzBn1hjiKmr+3k/FsrpGFnOmaLky95JqLeqxoVm4hQdm719ESYz/1QP3Tdd0e7bMF7fNSAgqQ== X-Received: by 2002:adf:b1d4:: with SMTP id r20mr1162787wra.308.1634755208639; Wed, 20 Oct 2021 11:40:08 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id d8sm2813835wrv.80.2021.10.20.11.40.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 11:40:08 -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?= , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 6/8] generate-cmdlist.sh: replace for loop by printf's auto-repeat feature Date: Wed, 20 Oct 2021 20:39:57 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1338.g20da966911a 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 Wed Oct 20 18:39:58 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: 12573027 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 D9C46C433EF for ; Wed, 20 Oct 2021 18:40:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BE6B7610E7 for ; Wed, 20 Oct 2021 18:40:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231359AbhJTSma (ORCPT ); Wed, 20 Oct 2021 14:42:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231312AbhJTSm0 (ORCPT ); Wed, 20 Oct 2021 14:42:26 -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 67727C061753 for ; Wed, 20 Oct 2021 11:40:11 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id t2so129378wrb.8 for ; Wed, 20 Oct 2021 11:40:11 -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=GRF8kM5tAvtcHtLYZnEEbjkfdP3gG9YkQE+erjeLxWM=; b=FKYbum7i+cQ8FxxRlRbcPR0NlETBiK3meE2xHDpQHqUosWRn1BX9sZVHt3AShbqxm3 zwf/W16M2j23SVwMTBcPEPe1n9kw0xHtfKQjSg1VbKWZSOaK7u/U58AHpYLCjkyUcw13 ZlnK4/5dZ5UAFfe1bUXCGbx3hSJbKG2/dG9N/F8BNKSxPKV9dD8wGH1qw0OmHZSGpVLG WUQMUMSbKCmO8sZRimUfdJEB6FZDEpW7qc+L3gNqzXOyTxYYhxOzcAhZwcNyBnRBjk38 voaC329TZRrhveV/W+ZqTHChbcKvSojacqhp16PPIrbslAstFIYoWTfTwmIALbJY1dS1 juVQ== 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=GRF8kM5tAvtcHtLYZnEEbjkfdP3gG9YkQE+erjeLxWM=; b=UPdApYbHV2e6bNVZqO/e1gWh5u3ZfRUvHPQ1vE7eSKM1BhL74Vx8maQvEn6adQrZZ4 CrPgfKNgBOJ/eGGMRIQxY4yTEsU+gQSBmQaeZCX/4yDiyJyNzZTMHPAxGz9p3UXKn/eL tjhkE+mfaPSfjtGO9D4tXERb7oLame+xaz8yqHlgf+i7R1O0vfPxH+5ke234RceHWgIK Xt+aw1EkKmhiZ3qwnsuhrpdSaQVfn12/RYLxayoF+/RrGY615kSW8dhbchLmzY2iAIBU N3AEcNM0Hub2SOOi/okp2xhQ1xV5Oay9Dfp9H0CZMphvcRILrdcMbbc9AQ72BKJH2DE2 Z/9g== X-Gm-Message-State: AOAM532OSR84F7J9hDO4aDIcqzwe+7YjuVS6z8DF8sEhkyf07eKHRJe9 9tAsT+RuogkLU+wJh40edIVkpCfP4ZYzRA== X-Google-Smtp-Source: ABdhPJxie4VZLwmvF42UNzokZjj62G9fk+DzInOuxxjKor7tQRifrggKWJ7fTggHh5E2mqj5Y3azKQ== X-Received: by 2002:adf:f902:: with SMTP id b2mr1099353wrr.265.1634755209619; Wed, 20 Oct 2021 11:40:09 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id d8sm2813835wrv.80.2021.10.20.11.40.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 11:40:08 -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?= , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 7/8] Makefile: stop having command-list.h depend on a wildcard Date: Wed, 20 Oct 2021 20:39:58 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1338.g20da966911a In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change the dependency graph for "command-list.h" so that it's not re-built in its entirety every time one file in Documentation/git*.txt changes. This makes the generation of the command-list.h use a pattern similar to that established in 8650c6298c1 (doc lint: make "lint-docs" non-.PHONY, 2021-10-15) for the "lint-docs" target. This change replaces the monolithic "generate-cmdlist.sh" invocation with a dependency chain like: Documentation/git-add.txt -> .build/command-list.h.d/git-add.gen (and "git-add.txt" intermediary) -> command-list.h I.e. we'll now generate intermediary files when extracting the "NAME" section the documentation. Here the 6th line of "Documentation/git.txt" will be extracted to ".build/command-list.h.d/git-add.gen.txt": git-add - Add file contents to the index We'll then create an intermediate ".build/command-list.h.d/git-add.gen" (leading "\t" stripped): ./generate-cmdlist.sh --entry-only .build/command-list.h.d/git-add.gen.txt { "git-add", N_("Add file contents to the index"), 0 | CAT_mainporcelain | CAT_worktree }, The "command-list.h" itself can the be made by having "generate-cmdlist.sh" emit only the header section, followed by: LC_ALL=sort .build/command-list.h.d/*.gen Unfortunately we can't drop the old code completely due to the CMake integration, see 061c2240b1b (Introduce CMake support for configuring Git, 2020-06-12). It will keep using the older and slower script. With this the initial creation of the command-list.h is a bit slower with -j1, but around 2x as fast -j8[1]. The real benefit comes from the more common case of an incremental build, say when only "Documentation/git-add.txt" was updated after a "pull". There we're 4-5x as fast with this new method[2]. The benefit of optimizing this is because this file is very frequently re-generated, e.g. for "git rebase -i --exec 'make git'" with "git-add.txt" modified we're around 1.7 times as fast[3]. That target will need to re-make "git" (via "help.o") due to help.c's use of command-list.h. In terms of implementation: I'm adding $(QUIET) while I'm at it, which is here so we don't quiet the equivalent of trace output under V=1, this could be used in other places that use "@cmd" to quiet "cmd" output. Some of the dependencies between "command-list.h" and "$(COMMAND_LIST_GEN)" are redundant, considering that the former depends on the latter. I'm sticking to listing dependencies mentioned in the rule itself, e.g. "command-list.h" itself calls "generate-cmdlist.sh", so I list the dependency even though it would get it via a recursive dependency. These rules can be lazy about leaving behind files on error thanks to the .DELETE_ON_ERROR flag, see 7b76d6bf221 (Makefile: add and use the ".DELETE_ON_ERROR" flag, 2021-06-29), or in the case of the "*.txt.gen" files because we'll unconditionally clobber them anyway if the relevant source file is touched, so we can leave them for "make clean". 1. Piped through: 2>/dev/null | grep -P -v "^\s*$"; ditto below: hyperfine -s basic -L j ", -j8" -L s ,.old -p 'rm -rf .build command-list.h' 'make{j} -f Makefile{s} command-list.h' Benchmark #1: make -f Makefile command-list.h Time (mean ± σ): 769.3 ms ± 90.4 ms [User: 892.4 ms, System: 98.8 ms] Range (min … max): 665.6 ms … 941.9 ms 10 runs Benchmark #2: make -j8 -f Makefile command-list.h Time (mean ± σ): 212.5 ms ± 45.0 ms [User: 954.4 ms, System: 136.9 ms] Range (min … max): 187.6 ms … 326.2 ms 11 runs Benchmark #3: make -f Makefile.old command-list.h Time (mean ± σ): 515.0 ms ± 70.5 ms [User: 613.8 ms, System: 110.9 ms] Range (min … max): 407.6 ms … 603.9 ms 10 runs Benchmark #4: make -j8 -f Makefile.old command-list.h Time (mean ± σ): 474.9 ms ± 62.7 ms [User: 569.7 ms, System: 106.0 ms] Range (min … max): 407.0 ms … 556.8 ms 10 runs Summary 'make -j8 -f Makefile command-list.h' ran 2.24 ± 0.56 times faster than 'make -j8 -f Makefile.old command-list.h' 2.42 ± 0.61 times faster than 'make -f Makefile.old command-list.h' 3.62 ± 0.88 times faster than 'make -f Makefile command-list.h' 2. hyperfine -s basic -L j ", -j8" -L s ,.old -p 'touch Documentation/git-add.txt' 'make{j} -f Makefile{s} command-list.h' Benchmark #1: make -f Makefile command-list.h Time (mean ± σ): 94.6 ms ± 26.7 ms [User: 83.0 ms, System: 14.1 ms] Range (min … max): 79.4 ms … 186.0 ms 15 runs Benchmark #2: make -j8 -f Makefile command-list.h Time (mean ± σ): 80.3 ms ± 10.5 ms [User: 81.3 ms, System: 12.9 ms] Range (min … max): 76.9 ms … 127.6 ms 37 runs Benchmark #3: make -f Makefile.old command-list.h Time (mean ± σ): 348.9 ms ± 174.5 ms [User: 415.3 ms, System: 70.6 ms] Range (min … max): 66.0 ms … 550.3 ms 43 runs Benchmark #4: make -j8 -f Makefile.old command-list.h Time (mean ± σ): 406.7 ms ± 157.1 ms [User: 473.4 ms, System: 78.3 ms] Range (min … max): 67.4 ms … 560.4 ms 34 runs Summary 'make -j8 -f Makefile command-list.h' ran 1.18 ± 0.37 times faster than 'make -f Makefile command-list.h' 4.34 ± 2.25 times faster than 'make -f Makefile.old command-list.h' 5.07 ± 2.07 times faster than 'make -j8 -f Makefile.old command-list.h' 3. hyperfine -s basic -L j " -j8" -L s ,.old -p 'touch Documentation/git-add.txt' 'make{j} -f Makefile{s} git' Benchmark #1: make -j8 -f Makefile git Time (mean ± σ): 484.2 ms ± 53.5 ms [User: 253.2 ms, System: 83.5 ms] Range (min … max): 400.7 ms … 580.5 ms 10 runs Benchmark #2: make -j8 -f Makefile.old git Time (mean ± σ): 836.7 ms ± 37.3 ms [User: 729.2 ms, System: 157.1 ms] Range (min … max): 774.2 ms … 885.6 ms 10 runs Summary 'make -j8 -f Makefile git' ran 1.73 ± 0.21 times faster than 'make -j8 -f Makefile.old git' Signed-off-by: Ævar Arnfjörð Bjarmason --- .gitignore | 1 + Makefile | 52 +++++++++++++++++++++++++++++++++++++++------ generate-cmdlist.sh | 36 +++++++++++++++++++++++++------ 3 files changed, 77 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 054249b20a8..dc03a988b16 100644 --- a/.gitignore +++ b/.gitignore @@ -198,6 +198,7 @@ *.[aos] *.o.json *.py[co] +.build/ .depend/ *.gcda *.gcno diff --git a/Makefile b/Makefile index 381bed2c1d2..ce4cce57eb8 100644 --- a/Makefile +++ b/Makefile @@ -1954,6 +1954,7 @@ endif ifneq ($(findstring s,$(MAKEFLAGS)),s) ifndef V + QUIET = @ QUIET_CC = @echo ' ' CC $@; QUIET_AR = @echo ' ' AR $@; QUIET_LINK = @echo ' ' LINK $@; @@ -2242,12 +2243,50 @@ config-list.h: generate-configlist.sh config-list.h: Documentation/*config.txt Documentation/config/*.txt $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@ -command-list.h: generate-cmdlist.sh command-list.txt - -command-list.h: $(wildcard Documentation/git*.txt) - $(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \ - $(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \ - command-list.txt >$@ +EXCLUDED_COMMAND_LIST = +EXCLUDED_COMMAND_LIST += git +EXCLUDED_COMMAND_LIST += git-bisect-lk2009 +EXCLUDED_COMMAND_LIST += git-credential-cache--daemon +EXCLUDED_COMMAND_LIST += git-fsck-objects +EXCLUDED_COMMAND_LIST += git-init-db +EXCLUDED_COMMAND_LIST += git-mergetool--lib +EXCLUDED_COMMAND_LIST += git-remote-ext +EXCLUDED_COMMAND_LIST += git-remote-fd +EXCLUDED_COMMAND_LIST += git-sh-i18n--envsubst +EXCLUDED_COMMAND_LIST += git-submodules +EXCLUDED_COMMAND_LIST += git-tools +EXCLUDED_COMMAND_LIST += git-version +EXCLUDED_COMMAND_LIST += git-web--browse +EXCLUDED_COMMAND_LIST += gitweb.conf + +EXCLUDED_TXT += $(patsubst %,Documentation/%.txt,$(EXCLUDED_PROGRAMS) $(EXCLUDED_COMMAND_LIST)) +COMMAND_LIST_TXT_DEP = $(filter-out $(EXCLUDED_TXT), $(wildcard Documentation/git*.txt)) + +COMMAND_LIST_GEN = $(patsubst Documentation/%.txt,.build/command-list.h.d/%.gen,$(COMMAND_LIST_TXT_DEP)) + +.build: + $(QUIET)mkdir .build +.build/command-list.h.d: | .build + $(QUIET)mkdir -p .build/command-list.h.d + +# We must depend on .build/command-list.h as an "order-only" +# prerequisite, its mtime will change when these targets run. +$(COMMAND_LIST_GEN): | .build/command-list.h.d +$(COMMAND_LIST_GEN): command-list.txt +$(COMMAND_LIST_GEN): generate-cmdlist.sh +$(COMMAND_LIST_GEN): .build/command-list.h.d/%.gen: Documentation/%.txt + $(QUIET)grep "^$(patsubst .build/command-list.h.d/%.gen,%,$@) " command-list.txt >$@.txt && \ + ./generate-cmdlist.sh --entry-only $@.txt >$@ + +command-list.h: $(COMMAND_LIST_GEN) +command-list.h: generate-cmdlist.sh +command-list.h: command-list.txt + $(QUIET_GEN){ \ + $(SHELL_PATH) ./generate-cmdlist.sh --header-only command-list.txt && \ + echo "static struct cmdname_help command_list[] = {" && \ + LC_ALL=C sort $(COMMAND_LIST_GEN) && \ + echo "};"; \ + } >$@ hook-list.h: generate-hooklist.sh Documentation/githooks.txt $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@ @@ -3238,6 +3277,7 @@ clean: profile-clean coverage-clean cocciclean $(RM) $(SP_OBJ) $(RM) $(HCC) $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json + $(RM) -r .build/ $(RM) -r po/build/ $(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope* $(RM) -r .dist-tmp-dir .doc-tmp-dir diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh index a1ab2b1f077..2bc528e8cae 100755 --- a/generate-cmdlist.sh +++ b/generate-cmdlist.sh @@ -15,7 +15,7 @@ get_category_line () { } category_list () { - command_list "$1" | + grep -v '^#' "$1" | cut -c 40- | tr ' ' '\012' | grep -v '^$' | @@ -23,13 +23,14 @@ category_list () { } get_synopsis () { + head -n 10 "Documentation/$1.txt" | sed -n ' /^NAME/,/'"$1"'/H ${ x s/.*'"$1"' - \(.*\)/N_("\1")/ p - }' "Documentation/$1.txt" + }' } define_categories () { @@ -61,16 +62,12 @@ define_category_names () { } print_command_list () { - echo "static struct cmdname_help command_list[] = {" - - command_list "$1" | while read cmd rest do printf " { \"$cmd\", $(get_synopsis $cmd), 0" printf " | CAT_%s" $(echo "$rest" | get_category_line) echo " }," done - echo "};" } exclude_programs= @@ -81,6 +78,19 @@ do shift done +header_only= +case $1 in +--entry-only) + shift + print_command_list $1 <"$1" + exit 0 + ;; +--header-only) + shift + header_only=t + ;; +esac + echo "/* Automatically generated by generate-cmdlist.sh */ struct cmdname_help { const char *name; @@ -92,4 +102,18 @@ define_categories "$1" echo define_category_names "$1" echo + +if test -n "$header_only" +then + exit 0 +fi + +# The old compatibility mode for CMmake. See 061c2240b1b (Introduce +# CMake support for configuring Git, 2020-06-12) +echo "static struct cmdname_help command_list[] = {" +grep -v \ + -e '^#' \ + -e '^git-fsck-objects ' \ + "$1" | print_command_list "$1" +echo "};" From patchwork Wed Oct 20 18:39:59 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: 12573029 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 77CF4C433F5 for ; Wed, 20 Oct 2021 18:40:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 60069610D0 for ; Wed, 20 Oct 2021 18:40:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231405AbhJTSml (ORCPT ); Wed, 20 Oct 2021 14:42:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231351AbhJTSm3 (ORCPT ); Wed, 20 Oct 2021 14:42:29 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28951C06176C for ; Wed, 20 Oct 2021 11:40:13 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id g39so16472399wmp.3 for ; Wed, 20 Oct 2021 11:40:13 -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=Nd8Xd2ivaTKtzZWuGBA7aJ+VshyewN7yC9C84sKUUxQ=; b=DIcaRRo2mC1LbgXOHVcizHrQ706Ne/LL/9qHthM0vafaf//i+Ma0mZoxvy1kd65OSx IN7jp3b+GDzas6LJ1DF+DlrStgnYywkWlZFWCNUw5Xu/TDT4zWpZSb+1nP40Dfye7gHd kS8xhBey1c69DSQFf0nFpoNh41qM+D7945YBej3ZPAXcGFg36FqP2AXLbSZBut1kLBU4 sD4roI1Ag5tQKnT4CsAPlWq1ptJhOH8aNliD4ueiQgu4WVP1dximTVpR7pdXcuJVNs2f 2RXHJgFVi5jSwg9FUkHpo6QdFb+2smNhX3xbX4BD5cY8ak7co6xHuV1vyRy/LiOLO1+R 6PLg== 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=Nd8Xd2ivaTKtzZWuGBA7aJ+VshyewN7yC9C84sKUUxQ=; b=NmD2uB4csOrFlGvxJXGzuOs+MBQgEnQ2SUNtdjO2IfjZefAgivS5YZoDk+j873vQl9 PRA7+VgRjkx7hpTS5bJ2Q4YMaOurubwxYV2xDwXgLxiOkA9/euRnSFwP/ZjbIX0nX6/q csTZyRnIb4OMHCGdLrS30Px/9HlZ98bZf2HEy1CvtVRpRwJHRPtoEsyHAnT6Zywhq/KT Y/CrMsTezpBMH9dHvrGemXhicmh71I6dHqFknXfljQ9iJRwV1BTP/aoDDnmP1l6gARHJ 0Kh3/qB/gyCKNfbBPyO1fJf4uzsKEDa142CeFhBqFSo6R7soUrRsG5skIH2GAVtcE9ND RRWA== X-Gm-Message-State: AOAM530NF2DWh0vOto0G763iWBerxUGoBQG1BAfA4aXV8IPrW462a93m WieWGd5hUWv38qTpXoicSy70uam2GPEC1Q== X-Google-Smtp-Source: ABdhPJyMKEMYC8FO7iAzMzQRFgbrXnY8nFys7p5YcP1kfAArB1GDp7TPwSRz5M+VZDD9ZI4XPvYkVA== X-Received: by 2002:a05:600c:215:: with SMTP id 21mr6685008wmi.119.1634755211142; Wed, 20 Oct 2021 11:40:11 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id d8sm2813835wrv.80.2021.10.20.11.40.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 11:40:09 -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?= , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 8/8] Makefile: assert correct generate-cmdlist.sh output Date: Wed, 20 Oct 2021 20:39:59 +0200 Message-Id: X-Mailer: git-send-email 2.33.1.1338.g20da966911a In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Because generate-cmdlist.sh invokes "sed" to extract the "NAME" blurb from the Documentation/git-*.txt files, we can end up with bad content if those files aren't what we expected. E.g. we'll emit multiple lines from that "sed" one-liner if the "NAME" section were to move further down than what our "head -n 10" covers. Let's assert that this can't happen by checking that the number of lines we make is what we'd expect to get. This means we can remove an assertion added in cfb22a02ab5 (help: use command-list.h for common command list, 2018-05-10). We'll catch this during compilation instead. There are still other cases where it's possible to generate a bad command-list.h, but the rest should be caught by a C compilation error. It would be possible to change our generated "command-list.h" to simply include this new ".build/command-list.h.gen" instead of cat-ing it in the Makefile, but let's leave the generated file as it is. Signed-off-by: Ævar Arnfjörð Bjarmason --- Makefile | 7 ++++++- generate-cmdlist.sh | 2 +- help.c | 3 --- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index ce4cce57eb8..711f0c064e6 100644 --- a/Makefile +++ b/Makefile @@ -2278,13 +2278,18 @@ $(COMMAND_LIST_GEN): .build/command-list.h.d/%.gen: Documentation/%.txt $(QUIET)grep "^$(patsubst .build/command-list.h.d/%.gen,%,$@) " command-list.txt >$@.txt && \ ./generate-cmdlist.sh --entry-only $@.txt >$@ +.build/command-list.h.gen: $(COMMAND_LIST_GEN) + $(QUIET)LC_ALL=C sort $(COMMAND_LIST_GEN) >$@ && \ + test $$(wc -l <$@) -eq $(words $(COMMAND_LIST_GEN)) + command-list.h: $(COMMAND_LIST_GEN) command-list.h: generate-cmdlist.sh command-list.h: command-list.txt +command-list.h: .build/command-list.h.gen $(QUIET_GEN){ \ $(SHELL_PATH) ./generate-cmdlist.sh --header-only command-list.txt && \ echo "static struct cmdname_help command_list[] = {" && \ - LC_ALL=C sort $(COMMAND_LIST_GEN) && \ + cat $< && \ echo "};"; \ } >$@ diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh index 2bc528e8cae..bdefa151ae1 100755 --- a/generate-cmdlist.sh +++ b/generate-cmdlist.sh @@ -23,7 +23,7 @@ category_list () { } get_synopsis () { - head -n 10 "Documentation/$1.txt" | + head -n 6 "Documentation/$1.txt" | sed -n ' /^NAME/,/'"$1"'/H ${ diff --git a/help.c b/help.c index 973e47cdc30..cd6dd4c2440 100644 --- a/help.c +++ b/help.c @@ -57,9 +57,6 @@ static void extract_cmds(struct cmdname_help **p_cmds, uint32_t mask) int i, nr = 0; struct cmdname_help *cmds; - if (ARRAY_SIZE(command_list) == 0) - BUG("empty command_list[] is a sign of broken generate-cmdlist.sh"); - ALLOC_ARRAY(cmds, ARRAY_SIZE(command_list) + 1); for (i = 0; i < ARRAY_SIZE(command_list); i++) {