From patchwork Tue Oct 4 13:20:46 2022 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: 12998310 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8686BC433FE for ; Tue, 4 Oct 2022 13:21:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229805AbiJDNVk (ORCPT ); Tue, 4 Oct 2022 09:21:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230226AbiJDNV2 (ORCPT ); Tue, 4 Oct 2022 09:21:28 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E50744DB67 for ; Tue, 4 Oct 2022 06:21:26 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id y23-20020a1c4b17000000b003bd336914f9so789956wma.4 for ; Tue, 04 Oct 2022 06:21:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Eg8JebrxPZPNrRBMxrHFES6tuYHIB+M235xOxhJkpEI=; b=hHVlGgscuqayacRSpoGUuDXC2dLNQTkvAB2xuqPneNd/DXEPRP40MgE4NoczfWMqh4 SL6LYvFZ/aRfWJLlirMz9m2YAIMi+gxowbgpz8B3Tw1SBje4k1SYCm2td5PGIHwXcZtI dttpuO288GAeq9/i27HPiZCtC+s6u2vvMQhf4ZMvCVD1+Fhi9FUL8nOZXIq1oL37Ps2h kfCbnIzgL1UbiCYbTufQRIZ/04u1W1GhfBb63/T/YCocaTdNHrIxfK4uNUUlGONqaG7+ W5bB/lrYZoba5PDNsxt/joDToLhWRwMPrt1p9Bq18h+N5ZtDLjALoUE7LXkYjVGgHy4X G4yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Eg8JebrxPZPNrRBMxrHFES6tuYHIB+M235xOxhJkpEI=; b=rB89984YiHE9SYh3EVlvBHTJZbS5IwCe+fgmZOpZNoAMYM9NMwuQbymA3fZnXZK4bY rB2V5zg12d9S7RCI4Sg8fX0AdKhV5L3yNd4LjXCEbLBuyDv8orpXnmbMifr615FW0IGU fUiCb6IPV/HLLraB2DwziTL0yKLNGnymrCSpDCRSbJrVjCVXFPjLvpfWZTd3ivT/sEJm +xT+IRUlSqn/PrUXH3Q87X2TeO6S6J6VLveFy58G0xjwu2WKOhPuVaQbd8vmam+eoSDj 7xgmtTJEP4x1oNVnoOI3Ic4AYnWUKIVwvmBRdcSMaHruhuodion4O0nNDGFF0Nh/cLc6 lePw== X-Gm-Message-State: ACrzQf27TZyvZ0K8lp3YhEt2AoiaSmg2Xv7fvWL47OZYkaxwwNka0RbG zbvWM4d593zK6sTnaPXn438YxpuWkFMZhQ== X-Google-Smtp-Source: AMsMyM7kAsXWm7tUuCEIXlQTRJU+2sPV0xSpGW1T1rdCcEr4xEz3nbN5nDLUSqu/SSRQKcAG7CtyMg== X-Received: by 2002:a7b:c84c:0:b0:3b3:3faa:10c3 with SMTP id c12-20020a7bc84c000000b003b33faa10c3mr10198565wml.94.1664889685033; Tue, 04 Oct 2022 06:21:25 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id f7-20020adfdb47000000b00228cbac7a25sm12429205wrj.64.2022.10.04.06.21.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Oct 2022 06:21:24 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Victoria Dye , Taylor Blau , Emily Shaffer , Jonathan Nieder , John Cai , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v3 01/34] tests: assert *.txt SYNOPSIS and -h output Date: Tue, 4 Oct 2022 15:20:46 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.rc2.935.g6b421ae1592 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Add a test to assert basic compliance with the CodingGuidelines in the SYNOPSIS and builtin -h output. For now we only assert that the "-h" output doesn't have "\t" characters, as a very basic syntax check. Subsequent commits will expand on the checks here as various issues are fixed, but let's first add the test scaffolding. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t0450-txt-doc-vs-help.sh | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 t/t0450-txt-doc-vs-help.sh diff --git a/t/t0450-txt-doc-vs-help.sh b/t/t0450-txt-doc-vs-help.sh new file mode 100755 index 00000000000..c8820bdd38f --- /dev/null +++ b/t/t0450-txt-doc-vs-help.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +test_description='assert (unbuilt) Documentation/*.txt and -h output' + +TEST_PASSES_SANITIZE_LEAK=true +. ./test-lib.sh + +test_expect_success 'setup: list of builtins' ' + git --list-cmds=builtins >builtins +' + +help_to_synopsis () { + builtin="$1" && + out_dir="out/$builtin" && + out="$out_dir/help.synopsis" && + if test -f "$out" + then + echo "$out" && + return 0 + fi && + mkdir -p "$out_dir" && + test_expect_code 129 git $builtin -h >"$out.raw" 2>&1 && + sed -n \ + -e '1,/^$/ { + /^$/d; + s/^usage: //; + s/^ *or: //; + p; + }' <"$out.raw" >"$out" && + echo "$out" +} + +HT=" " + +while read builtin +do + # -h output assertions + test_expect_success "$builtin -h output has no \t" ' + h2s="$(help_to_synopsis "$builtin")" && + ! grep "$HT" "$h2s" + ' +done X-Patchwork-Id: 12998311 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6506FC433F5 for ; Tue, 4 Oct 2022 13:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229731AbiJDNVl (ORCPT ); Tue, 4 Oct 2022 09:21:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229748AbiJDNV3 (ORCPT ); Tue, 4 Oct 2022 09:21:29 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 159D550513 for ; Tue, 4 Oct 2022 06:21:28 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id b4so14339018wrs.1 for ; Tue, 04 Oct 2022 06:21:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2dVodM6Mq41nOjnuweYMPZnn79wFF8vKTSsZTpAioH0=; b=nP9mUBwG1QNZSiw0Lr8OwKN3rvDwxXvDcPAAgvYgvXUtfqgcqwuhP5oFNCRVAYuo8S tK194Bi2w+VKv7H40njLRcF85AT1Km59oJagTIVSPllu+oTzHC679T3rH+8CbcYRstEV XXz4vdVVd7HEXJRvjV5fKDCEQsRN1xII9ObB09d5ETc61EOW+BeG59eY+5V3YDS6HoAA IZl4ULYGB3vMFODe7y692hhOr7bwBalghquhQva40T1LMfCyjocKC813KoaLFQmqiuZN mm8jPaTB2CXI9O9r2VsNbYkH0Es1fKrK3nPxMyr0fsb2wMwPdv4K3nDnnfRELeXkZ0Cs AAEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2dVodM6Mq41nOjnuweYMPZnn79wFF8vKTSsZTpAioH0=; b=d5vvrZeSiOjqlVqHsxoY07oxxQBYVCYcNRjUV2MCxCFk2UzrfG6VNV4mYrVCys7cIy ZAprYzLnj4sDzbZiyTB7TA+tNMvyiqk5ggG4Xe+kvJ/ARrCjdAv2KEXFan4/SG83S1rw fSCvSXjqBo4UvMR3/33aZdcJ+ZfyvFuvbG495xnygUaTE5oGQT5Ng91gPca+aYTRAJM+ Z2yhZi/kOSf9UoGQWDnbElfg25yLhJDZIHIbxEjCNw/2NxlW66RJsF6YjEulqqyA8SxB LaOQvc8hZV91eZuwUN9JUpnSNNaI8KqJYLBgyNkHRmeYjkyPgBuPzD7+b2q8CngBtg+y ZsoA== X-Gm-Message-State: ACrzQf3OlPfSaRFk6S86nbnzZPVdLXhXxqbEG5PytyiFNhp1orAMgdOx 2WUKXNQf4apLT1qhf3rY7xekbPvs56QQTA== X-Google-Smtp-Source: AMsMyM6ADmw0SvdepKSRh/92ZW9NHbpDud1HS5yIg/D4jk6uPCQk6pQBVvobs5VpUSDkTJirKP3/aQ== X-Received: by 2002:a05:6000:1842:b0:22a:4d1d:4bd6 with SMTP id c2-20020a056000184200b0022a4d1d4bd6mr16032104wri.603.1664889686277; Tue, 04 Oct 2022 06:21:26 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id f7-20020adfdb47000000b00228cbac7a25sm12429205wrj.64.2022.10.04.06.21.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Oct 2022 06:21:25 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Victoria Dye , Taylor Blau , Emily Shaffer , Jonathan Nieder , John Cai , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v3 02/34] CodingGuidelines: update and clarify command-line conventions Date: Tue, 4 Oct 2022 15:20:47 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.rc2.935.g6b421ae1592 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Edit the section which explains how to create a good SYNOPSIS section for clarity and accuracy, it was mostly introduced in c455bd8950e (CodingGuidelines: Add a section on writing documentation, 2010-11-04): * Change "extra" example to "file", which now naturally follows from previous "..." example (one or more) to "[...]" (zero or more). * Explain how we prefer spacing around "[]()" tokens and "|" alternatives, this is not a new policy, but just codifies what's already the pattern in the most wide use in the documentation. Having a space around " | " for flags, but not for flag values is inconsistent, but this style guide codifies existing patterns. Grepping shows that we don't have any instance matching the second "Don't" example: git grep -E -h -o '=\([^)]+\)' -- builtin Documentation/ Signed-off-by: Ævar Arnfjörð Bjarmason --- Documentation/CodingGuidelines | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index 9fca21cc5f9..3d3bdeba9e4 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -650,8 +650,8 @@ Writing Documentation: (One or more of .) Optional parts are enclosed in square brackets: - [] - (Zero or one .) + [...] + (Zero or more of .) --exec-path[=] (Option with an optional argument. Note that the "=" is inside the @@ -665,6 +665,16 @@ Writing Documentation: [-q | --quiet] [--utf8 | --no-utf8] + Use spacing around "|" token(s), but not immediately after opening or + before closing a [] or () pair: + Do: [-q | --quiet] + Don't: [-q|--quiet] + + Don't use spacing around "|" tokens when they're used to seperate the + alternate arguments of an option: + Do: --track[=(direct|inherit)] + Don't: --track[=(direct | inherit)] + Parentheses are used for grouping: [( | )...] (Any number of either or . Parens are needed to make From patchwork Tue Oct 4 13:20:48 2022 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: 12998313 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C2B9C43217 for ; Tue, 4 Oct 2022 13:21:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230032AbiJDNVp (ORCPT ); Tue, 4 Oct 2022 09:21:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229796AbiJDNVb (ORCPT ); Tue, 4 Oct 2022 09:21:31 -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 874AACE3E for ; Tue, 4 Oct 2022 06:21:29 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id bq9so21306103wrb.4 for ; Tue, 04 Oct 2022 06:21:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KNsiYuRQSP+tfKsK0fGGzhUJVjHNLbZA9YRouJmlX0c=; b=JjTyfoVX1GhBfItfu3wnUPuJgygo5yNb3YTK8JQJAmMVs8mPspXCxQXRKCQHcW5yDM sf3XRBBkBR3HclEhYXOIM/ULZmaiDO7iGVpS35/Kk0gaUjreSxZlr1WXgVScvY77Pnls ZWzVYhSxLq16krzDu4QoAPM3DuPkEThTXLNQXhsTymxiIyQZnbKVU7lzhBmI3urXt+Cb 3LrkGz7yD+gCTVn+6IrsmLaWLENRBRHUyaj8Tp3rVnMdvQm17vJ/lWsVoI/7nkhDgFQz mrV7SysCud4i7EkAAyefDaeQLIUB5n5ZvdINtVa5CwijDOK7I1sziR1D1TOSlHhAlc4d LPRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KNsiYuRQSP+tfKsK0fGGzhUJVjHNLbZA9YRouJmlX0c=; b=Tz4aa3HfnrmlICUWTL9T/QgZiggdCOWJRYkv8aN9H7tV2Qb+f+cOs7xeI48y8pEVLA T0IhrQWm+oaHyCNh0JaQYEsJpehgMv+plpNReb+Z7wwONdgtovaO5fTCzTwkfjesPZPQ Ymz4WJgaNVaYRMqu/0if+3nr9Cd8M6FtICE9pkOP9ARmewF7b7HwwppnhBB5fKrw4owi 975EnSYdoJ5HoNQkz1u+qWfWTQq0g/T0+xPBLBMn8DXustAUVLGWDcF1BaPD6vf0gJrK BfhA3wMbdm+J2yz6V9p9TZ2ajjBmQlAs6kBW7cTETGZ7BhADZgFEJ4JARpqVP0c7Upbd 0IWg== X-Gm-Message-State: ACrzQf0+T+YzFeMXtNP4XYPgNAAE+IAlRTmyCRrELe1ecwKhFQZGhsbB Q+vit1/eq29D1mybVre0VC/tJm8IMfSAFw== X-Google-Smtp-Source: AMsMyM5vTpTSYBj3TVEj6ccumF5zBx3dFHFcodOoKCOzeMJqS3YlYwUjLsXflZFrvWDI01fgykUbUw== X-Received: by 2002:adf:ed41:0:b0:225:3fde:46ea with SMTP id u1-20020adfed41000000b002253fde46eamr16112656wro.345.1664889687646; Tue, 04 Oct 2022 06:21:27 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id f7-20020adfdb47000000b00228cbac7a25sm12429205wrj.64.2022.10.04.06.21.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Oct 2022 06:21:26 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Victoria Dye , Taylor Blau , Emily Shaffer , Jonathan Nieder , John Cai , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v3 03/34] builtin/bundle.c: indent with tabs Date: Tue, 4 Oct 2022 15:20:48 +0200 Message-Id: X-Mailer: git-send-email 2.38.0.rc2.935.g6b421ae1592 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Fix indentation issues introduced with 73c3253d75e (bundle: framework for options before bundle file, 2019-11-10), and carried forward in some subsequent commits. Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/bundle.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/builtin/bundle.c b/builtin/bundle.c index e80efce3a42..5c78894afd5 100644 --- a/builtin/bundle.c +++ b/builtin/bundle.c @@ -12,31 +12,31 @@ */ static const char * const builtin_bundle_usage[] = { - N_("git bundle create [] "), - N_("git bundle verify [] "), - N_("git bundle list-heads [...]"), - N_("git bundle unbundle [...]"), - NULL + N_("git bundle create [] "), + N_("git bundle verify [] "), + N_("git bundle list-heads [...]"), + N_("git bundle unbundle [...]"), + NULL }; static const char * const builtin_bundle_create_usage[] = { - N_("git bundle create [] "), - NULL + N_("git bundle create [] "), + NULL }; static const char * const builtin_bundle_verify_usage[] = { - N_("git bundle verify [] "), - NULL + N_("git bundle verify [] "), + NULL }; static const char * const builtin_bundle_list_heads_usage[] = { - N_("git bundle list-heads [...]"), - NULL + N_("git bundle list-heads [...]"), + NULL }; static const char * const builtin_bundle_unbundle_usage[] = { - N_("git bundle unbundle [...]"), - NULL + N_("git bundle unbundle [...]"), + NULL }; static int parse_options_cmd_bundle(int argc,