From patchwork Tue Jun 28 10:05:23 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: 12898017 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 9F995C43334 for ; Tue, 28 Jun 2022 10:06:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344676AbiF1KGN (ORCPT ); Tue, 28 Jun 2022 06:06:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242996AbiF1KGL (ORCPT ); Tue, 28 Jun 2022 06:06:11 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D219C2DD74 for ; Tue, 28 Jun 2022 03:06:10 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id e28so11740816wra.0 for ; Tue, 28 Jun 2022 03:06: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=wC2fD32nZCXyBHEu7qLiVPQBP771Zs+EAnSAMRVzoI8=; b=NrZh0FlG46RBbTqmSnsMn0WQVYkYlWNcKMJeScfhZFqY1C8B0pWe/qdBq1PdWNPiQk y6bTPUxTE2sey/YuyRf14qNuODrzjpQMgwM4dGY1ylGkiMXGaIJ/AK44rwKppb8RR52b R1UBSq15++4EznIsLncymRRVGk/VPp0+wzcrmnDyg/Fa+AEM3hHB7debk5y/SUQAwmQA vUJYD5VMftX1vvCKwkKs3rkWn81/Wb10ur9Skq7JBAW78O5ZS9lhCCue8u8NJOi0JT3L IaUX/nTDSLHKKG108guzsvY5VbWRPEp8C7pf9EET7Mda+uSAYPlNxN1FC/KrNlaHRtyx 2qUg== 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=wC2fD32nZCXyBHEu7qLiVPQBP771Zs+EAnSAMRVzoI8=; b=lPW7LDuktZx6GOQGuz5mKqYq6hOFZcy3XRgI7AXnAKcDaAJe8QubHtWBH40x6N5uJD Wj67bfnM0eDoKPXBd+RinzT4ckffaSE4Y2RSdvWWmGUIuF4Wzt5gXusI/MNiOZW+apT1 oAyHw5lLb4V4r8Yf014mj4Hj652HOnan8KnTP45qS2h1JJ5mm6Ww+SouRtrYW7EpItwR doti1+fDAg1u9AtHQuFOnzVBPi3HBgMoNGDMrxqwyHc7y27ODnjOyfnmH1pYyNbxji4O W2lt6NIlVKYa9IM4DGbRXVelnFeJWnMROU+CwJRlnypZMEr/DiRtKxRdEcF+YnFj2V4l ecIw== X-Gm-Message-State: AJIora/Zf+F3J+0UXJHpzhOn6jN6jlZBPhIzpIaW4vII6jrZrl/gkZ1k 6d57c5+TeEZpVW16b45ljFRD6hTJcu8= X-Google-Smtp-Source: AGRyM1saekzv3NOZEzKw4vD3cv2riQLbdpPMs65JcRirY1yIYucfMqKvcRKl1mHUk65i61fHJDlDPw== X-Received: by 2002:adf:fbd0:0:b0:21b:90cd:69f2 with SMTP id d16-20020adffbd0000000b0021b90cd69f2mr16238700wrs.525.1656410768938; Tue, 28 Jun 2022 03:06:08 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e16-20020a5d4e90000000b0021b91d1ddbfsm12914430wru.21.2022.06.28.03.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 03:06:08 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Glen Choo , Atharva Raykar , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v4 01/12] git-submodule.sh: remove unused sanitize_submodule_env() Date: Tue, 28 Jun 2022 12:05:23 +0200 Message-Id: X-Mailer: git-send-email 2.37.0.880.gf07d56b18ba In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The sanitize_submodule_env() function was last used before b3c5f5cb048 (submodule: move core cmd_update() logic to C, 2022-03-15), let's remove it. This also allows us to remove clear_local_git_env() from git-sh-setup.sh. That function hasn't been documented in Documentation/git-sh-setup.sh, and since 14111fc4927 (git: submodule honor -c credential.* from command line, 2016-02-29) it had only been used in the sanitize_submodule_env() function being removed here. Signed-off-by: Ævar Arnfjörð Bjarmason --- git-sh-setup.sh | 7 ------- git-submodule.sh | 11 ----------- 2 files changed, 18 deletions(-) diff --git a/git-sh-setup.sh b/git-sh-setup.sh index d92df37e992..ecb60d9e3cb 100644 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -285,13 +285,6 @@ get_author_ident_from_commit () { parse_ident_from_commit author AUTHOR } -# Clear repo-local GIT_* environment variables. Useful when switching to -# another repository (e.g. when entering a submodule). See also the env -# list in git_connect() -clear_local_git_env() { - unset $(git rev-parse --local-env-vars) -} - # Generate a virtual base file for a two-file merge. Uses git apply to # remove lines from $1 that are not in $2, leaving only common lines. create_virtual_base() { diff --git a/git-submodule.sh b/git-submodule.sh index fd0b4a2c947..bc436c4ca47 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -56,17 +56,6 @@ isnumber() n=$(($1 + 0)) 2>/dev/null && test "$n" = "$1" } -# Sanitize the local git environment for use within a submodule. We -# can't simply use clear_local_git_env since we want to preserve some -# of the settings from GIT_CONFIG_PARAMETERS. -sanitize_submodule_env() -{ - save_config=$GIT_CONFIG_PARAMETERS - clear_local_git_env - GIT_CONFIG_PARAMETERS=$save_config - export GIT_CONFIG_PARAMETERS -} - # # Add a new submodule to the working tree, .gitmodules and the index # From patchwork Tue Jun 28 10:05:24 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: 12898018 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 4227DC433EF for ; Tue, 28 Jun 2022 10:06:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344718AbiF1KGR (ORCPT ); Tue, 28 Jun 2022 06:06:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344666AbiF1KGM (ORCPT ); Tue, 28 Jun 2022 06:06:12 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAEE9B78 for ; Tue, 28 Jun 2022 03:06:11 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id i25so11391599wrc.13 for ; Tue, 28 Jun 2022 03:06: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=8RkEeuNcgA106GnboT2kf6jZh6qclVic8rYXy+0Ntv4=; b=p/49C3Eox4EA8MrO+1ltw7YGLYZCeEIkV3uvXj9VVEaBmpJD8U8GCYcztxE6y3UHxv LK4XmxW84YhzN/Wd9bKV/1Dr8G0eNo797q0lmvPK7BwRb81nsQlGU3sCkzS9IsmlDRWx ZAMFr0TEUx4ROLVOkHM5yS9WkJtT99LBb1+JsjkimalcZQzJftKtC1mSYVwDN+KkfUwj mDha6d29Dg2LV0hlmShcBLLMgrHqIiwSmXcBQNjTr8dBvOhBL9oUrFA2cB+rc1NTG8ZR 5qw4luVGUolLGkOSS90jAcIzTitWlHw0jhX59t8yOlIgTfOQRh++aBwSMh7hvQWQF7Zx OysA== 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=8RkEeuNcgA106GnboT2kf6jZh6qclVic8rYXy+0Ntv4=; b=Q2PNtozSdlIwbj+QCm2Gbsx9TbEIt5yp4kGZ+2+DurcMhoa8Ad5d7GRtNPYDP9mWMz GImXd/Q2MQ3oif1cETilvM4G8klPG1nMgZDZrnao4EXrF0uP+waDX4QeBxrX2JaGW9de K4vj7ualA9LVaRPW7uDT7/OTt2Q3hT9bOH3DMCIcCgiotHLO9l1k8wBZFb7EXgm/VdEv JUAutEkGrbKiZibcERsriIIS+txapnt1q7awd2S1Hh0BmjllNU8JxqAS0plskG1PBsmP WQ0YMwaLflj1Ev8brvSoYlsqasgoFZW1O9GSgVGzOtx170QLhhUqZcuy1n5i41gSK0b4 pAJQ== X-Gm-Message-State: AJIora8KyJZ6i3LV7+Lp4hZYZFnay40Gy71FXYreGnRbxTy6KTPbIgC/ F5f+IvUSpnGYs9L0ahTKZPEW5bOdFUU= X-Google-Smtp-Source: AGRyM1vkpdZTtEmy3K+reYxmVAyEi5lEOq4P5j45vfFNKzJ6lWBoMOKIjgwmofILXQC4POurFVzN4Q== X-Received: by 2002:a5d:688e:0:b0:21b:9d51:25d2 with SMTP id h14-20020a5d688e000000b0021b9d5125d2mr17308364wru.286.1656410770014; Tue, 28 Jun 2022 03:06:10 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e16-20020a5d4e90000000b0021b91d1ddbfsm12914430wru.21.2022.06.28.03.06.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 03:06:09 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Glen Choo , Atharva Raykar , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v4 02/12] git-submodule.sh: remove unused $prefix variable Date: Tue, 28 Jun 2022 12:05:24 +0200 Message-Id: X-Mailer: git-send-email 2.37.0.880.gf07d56b18ba In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Remove the $prefix variable which isn't used anymore, and hasn't been since b3c5f5cb048 (submodule: move core cmd_update() logic to C, 2022-03-15). Before that we'd use it to invoke "git submodule--helper" with the "--recursive-prefix" option, but since b3c5f5cb048 that "git submodule--helper" option is only used when it invokes itself. So the "--recursive-prefix" option is still in use, but at this point only when the helper invokes itself during submodule recursion. See the "--recursive-prefix" option added in c51f8f94e5b (submodule--helper: run update procedures from C, 2021-08-24). Signed-off-by: Ævar Arnfjörð Bjarmason --- git-submodule.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/git-submodule.sh b/git-submodule.sh index bc436c4ca47..53847bbf6e2 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -41,7 +41,6 @@ files= remote= nofetch= update= -prefix= custom_name= depth= progress= @@ -127,7 +126,7 @@ cmd_add() usage fi - git ${wt_prefix:+-C "$wt_prefix"} ${prefix:+--super-prefix "$prefix"} submodule--helper add ${GIT_QUIET:+--quiet} ${force:+--force} ${progress:+"--progress"} ${branch:+--branch "$branch"} ${reference_path:+--reference "$reference_path"} ${dissociate:+--dissociate} ${custom_name:+--name "$custom_name"} ${depth:+"$depth"} -- "$@" + git ${wt_prefix:+-C "$wt_prefix"} submodule--helper add ${GIT_QUIET:+--quiet} ${force:+--force} ${progress:+"--progress"} ${branch:+--branch "$branch"} ${reference_path:+--reference "$reference_path"} ${dissociate:+--dissociate} ${custom_name:+--name "$custom_name"} ${depth:+"$depth"} -- "$@" } # @@ -189,7 +188,7 @@ cmd_init() shift done - git ${wt_prefix:+-C "$wt_prefix"} ${prefix:+--super-prefix "$prefix"} submodule--helper init ${GIT_QUIET:+--quiet} -- "$@" + git ${wt_prefix:+-C "$wt_prefix"} submodule--helper init ${GIT_QUIET:+--quiet} -- "$@" } # @@ -346,7 +345,6 @@ cmd_update() ${init:+--init} \ ${nofetch:+--no-fetch} \ ${wt_prefix:+--prefix "$wt_prefix"} \ - ${prefix:+--recursive-prefix "$prefix"} \ ${update:+--update "$update"} \ ${reference:+"$reference"} \ ${dissociate:+"--dissociate"} \ From patchwork Tue Jun 28 10:05:25 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: 12898019 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 14B35C43334 for ; Tue, 28 Jun 2022 10:06:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344677AbiF1KG3 (ORCPT ); Tue, 28 Jun 2022 06:06:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344682AbiF1KGO (ORCPT ); Tue, 28 Jun 2022 06:06:14 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AC692E9E1 for ; Tue, 28 Jun 2022 03:06:12 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id d17so11269139wrc.10 for ; Tue, 28 Jun 2022 03:06:12 -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=dYGXVYml6v5OQb5wpdTIvOmJ9DEIlen3XzcVVCfN/CE=; b=MrsxWPx/KTzcPPQtoZzkTzoPvEGWuc0pM2OtgiCx+GDWYJe5cjarMNE42U+oMdA9z1 Pg8wZ80ueBfsNQigH00zS/Ue5iZxbBwLD8LTVBihxghNo7fXuIF9QYhIwByagP70kPYg nI0wQK1T2c2JQwAQo6kQAdNGFTYDPmEJe2WE9IIfGyLS8BcvU5xZC9hIxgUretTXHhGn SZF+szb1GeqVKr23gvDiC0pl4b3cwHLLojwrIOqYt0wXo1lbJWK1atD5Y+6+KdycRRW/ QJpiCYOIZ3i9ZYR1QSeL0qlqnUgkDfGSEWPOYvJky5P9LlAYCAC3vD7GIVV+kRDTukyd kWIQ== 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=dYGXVYml6v5OQb5wpdTIvOmJ9DEIlen3XzcVVCfN/CE=; b=Vbyr6jwBiofWYo6ONTv3JtHTP/reUZKaZ3OoMRtw33fhKOoFBK0Y3i4uL98IyGq4B+ Mm3FXHRh5Zzoa1pNC/RfneNqqQI2VA4y+JTRnKKJewYkE6CWtYf1fSFg4NJfz6/S8TrL 986/ihdoN7STE6GODt/vkrmNvO3Ix7B7l50SZzQbKxSsRYAnU68rq2l7KKEBrFWEBPif zvrpZmF9EiC1N0EpLJHiD9YijifNpu7sIlYeivAh/m3I+M/wPMQdEwDVPThn5UxDbIdJ MqOShJZqzBmoCt7Mo5tDWRqzb+tAWm3RElVif/l+j0su4j78htoX2s7uPUI6QnXUafJy 0r+A== X-Gm-Message-State: AJIora9a3JMgRo0YPYY2kp+1ep0pj+hKhawO2mJADCc7mFRIVC/NH1/F bfeMIc6y/idSYvPWBVM7zP/7EMqZt5XDpA== X-Google-Smtp-Source: AGRyM1s7OkwMYoCSpJn5Lq5HSjVX+kp97KzIO06NkyaOntevx8IJq+LYGO5OKL6ELS/dPaLwgFX7qw== X-Received: by 2002:a5d:598e:0:b0:219:ea16:5a2a with SMTP id n14-20020a5d598e000000b00219ea165a2amr16436596wri.343.1656410771222; Tue, 28 Jun 2022 03:06:11 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e16-20020a5d4e90000000b0021b91d1ddbfsm12914430wru.21.2022.06.28.03.06.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 03:06:10 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Glen Choo , Atharva Raykar , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v4 03/12] git-submodule.sh: make the "$cached" variable a boolean Date: Tue, 28 Jun 2022 12:05:25 +0200 Message-Id: X-Mailer: git-send-email 2.37.0.880.gf07d56b18ba In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Remove the assignment of "$1" to the "$cached" variable. As seen in the initial implementation in 70c7ac22de6 (Add git-submodule command, 2007-05-26) we only need to keep track of if we've seen the --cached option, not save the "--cached" string for later use. In 28f9af5d25e (git-submodule summary: code framework, 2008-03-11) "$1" was assigned to it, but since there was no reason to do so let's stop doing it. This trivial change will make it easier to reason about an eventual change that'll remove the cmd_summary() function in favor of dispatching to "git submodule--helper summary" directly. Signed-off-by: Ævar Arnfjörð Bjarmason --- git-submodule.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git-submodule.sh b/git-submodule.sh index 53847bbf6e2..b99a00d9f84 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -446,7 +446,7 @@ cmd_summary() { do case "$1" in --cached) - cached="$1" + cached=1 ;; --files) files="$1" @@ -583,7 +583,7 @@ do branch="$2"; shift ;; --cached) - cached="$1" + cached=1 ;; --) break From patchwork Tue Jun 28 10:05:26 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: 12898024 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 835E0CCA480 for ; Tue, 28 Jun 2022 10:06:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344731AbiF1KGg (ORCPT ); Tue, 28 Jun 2022 06:06:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344700AbiF1KGP (ORCPT ); Tue, 28 Jun 2022 06:06:15 -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 13ECB2E9F1 for ; Tue, 28 Jun 2022 03:06:14 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id i25so11391734wrc.13 for ; Tue, 28 Jun 2022 03:06:14 -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=sLdd2zI7oDIBBxozChwG9QxyE+C58IfsKhy73Uc9Zww=; b=AR5yfeosf/2ujv7pbMIGzN9dZUoOmM3mxb9FVYVLna9Q+mAMnMPv5KsYNY7/gFGSUh HivapZGJwl99sF/34/9NeCrWdBe5+XpoUG4iY4fw0Pga7J09VUslHObaTgY/qd6a79Y9 R+bERgeoSWsb48/QW2Ek7FdgBITJFRo2RFoIBkZym++UgA3CGWBnowroqs9HicHuBBQs HtXF472yyvtfO1lfKHzpIt7N90eFQfK+F+rjRAJ0Sd8PpLu12xs85/aoi591MPYGRyCb Ujn6o0RELz9Ydp8pbmFFUkwhnd22lNYgYTVQmVhfiuK5XXdyrGWPjaaX8K1HXCvRK6Eq epkg== 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=sLdd2zI7oDIBBxozChwG9QxyE+C58IfsKhy73Uc9Zww=; b=D2wSvfU6pAUIJSOQ3uKMn/2B57PJBAD4opM5r+X9WQWaxuS+l+ZVUd12TmpImzEP4x S6M6Ffb3Ww9TIwkMRFOloeXwp28KQBlBU4xwwgswsMUh+zWNwUK11n28tyqj2xPTZScr ac/ISpzUo9oHtcKga2NKhMPHbq43FBkRm62kwkolhFtqTdyMEyu5I1ZtWrYi3Av88epr gJmVFGZE4Vl/hh1IzVk5eSrLtehETxb1jXooeEAPLvev3Ripk0G2LgO6iVyFMkLt7wby YGnliGRlWsM8yXAhptJn0yyWQwV4NgKHDHBXaFx+1Uf4mcEKRsOsfoIhSHkBkhODhD6z uCiQ== X-Gm-Message-State: AJIora+ZuZ4tAWqJOxHLpE6UgvuzJCF/+LYCYD4TNpf/+APZmAY94MVC 9h03663YxgZstyl23XCCCT8U3INTK5ondw== X-Google-Smtp-Source: AGRyM1v2X0D8V4I+5l6P+geZvtwQxbkysvcCi6puKbe+NaYnTusARr+Q0asJG1PJpQ+E7e5z23JRmg== X-Received: by 2002:a05:6000:1885:b0:21b:ad25:8ae6 with SMTP id a5-20020a056000188500b0021bad258ae6mr16368620wri.183.1656410772249; Tue, 28 Jun 2022 03:06:12 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e16-20020a5d4e90000000b0021b91d1ddbfsm12914430wru.21.2022.06.28.03.06.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 03:06:11 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Glen Choo , Atharva Raykar , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v4 04/12] git-submodule.sh: remove unused top-level "--branch" argument Date: Tue, 28 Jun 2022 12:05:26 +0200 Message-Id: X-Mailer: git-send-email 2.37.0.880.gf07d56b18ba In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In 5c08dbbdf1a (git-submodule: fix subcommand parser, 2008-01-15) the "--branch" option was supported as an option to "git submodule" itself, i.e. "git submodule --branch" as a side-effect of its implementation. Then in b57e8119e6e (submodule: teach set-branch subcommand, 2019-02-08) when the "set-branch" subcommand was added the assertion that we shouldn't have "--branch" anywhere except as an argument to "add" and "set-branch" was copy/pasted from the adjacent check for "--cache" added (or rather modified) in 496eeeb19b9 (git-submodule.sh: avoid "test -a/-o ", 2014-06-10). But there's been a logic error in that check, which at a glance looked like it should be supporting: git submodule --branch (add | set-branch) [] But due to "||" in the condition (as opposed to "&&" for "--cache") if we have "--branch" here already we'll emit usage, even for "add" and "set-branch". So in addition to never having documented this form, it hasn't worked since b57e8119e6e was released with v2.22.0. So it's safe to remove this code. I.e. we don't want to support the form noted above, but only: git submodule (add | set-branch) --branch [] Signed-off-by: Ævar Arnfjörð Bjarmason --- git-submodule.sh | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/git-submodule.sh b/git-submodule.sh index b99a00d9f84..20fc1b620fa 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -574,14 +574,6 @@ do -q|--quiet) GIT_QUIET=1 ;; - -b|--branch) - case "$2" in - '') - usage - ;; - esac - branch="$2"; shift - ;; --cached) cached=1 ;; @@ -609,12 +601,6 @@ then fi fi -# "-b branch" is accepted only by "add" and "set-branch" -if test -n "$branch" && (test "$command" != add || test "$command" != set-branch) -then - usage -fi - # "--cached" is accepted only by "status" and "summary" if test -n "$cached" && test "$command" != status && test "$command" != summary then From patchwork Tue Jun 28 10:05:27 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: 12898025 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 24450C433EF for ; Tue, 28 Jun 2022 10:06:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344754AbiF1KGi (ORCPT ); Tue, 28 Jun 2022 06:06:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344721AbiF1KGT (ORCPT ); Tue, 28 Jun 2022 06:06:19 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B60D2EA13 for ; Tue, 28 Jun 2022 03:06:14 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id i1so12415345wrb.11 for ; Tue, 28 Jun 2022 03:06:14 -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=YntMMDRKuJSFBVTFnlJULHQxXtAYpz3qj9xgHOA6a/E=; b=SPvtSTfYO7oAqCPVXyxbAW58doZX4RzYCPEueJqKttv+nUWgohtXaLX/BEwtzEUJl6 xc4aauWky2J67OtRjcy2j40wYUqh2EDoPQDSjCSOipqgqfpLI7OIdhW12/AjZ0/VlNI4 Cwta5QhW4tHbW+RLNgKNK286w0w2XwteqL5MpV2SjdRh3csPMfUtqg88WKNUpWqu7G3c u85qbCIdQpw+rJ6FB7Mw0vEySKDa8JguMNL21RBZJXZopnmQRn10Hsyp2BlQ6pJwgiLM b4w8020VZClMk1EO3H5ftGpZMDugQjlPxbIP8MEX0jWj4PBv6LjcKSYAvnIuSZKKtqL2 ZLAw== 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=YntMMDRKuJSFBVTFnlJULHQxXtAYpz3qj9xgHOA6a/E=; b=ma2nh8rUUEqOnBG+IeCZCOxbyF5T7fuhoIbAGJ3L6pT8HsYo+blelajoPHNyg5bFFY d+58HoORzN3b4llx9mcLcBe7RWH98QEjAggAxT2eOjkHOshi5VU4uVhgq8uDp9aDQadj em8b4I6X5Fig/KWiCDju8CpaH3HfsG3iOAEO3Ja63sfLQhfsJVE27y/1q5SEijUG/ib9 Gm4Dxarr9OMAlpXRzbSvBUebfGlKOsZnlHg3sPf9i/Gh5kdHHuSFVJWELouZleSPwtc8 N+oukPrMfrd8XFud404sWESeOhiptzyNY7566kHzLPSeFrvfdrJl5R5TGxUlT0519XX6 Ynaw== X-Gm-Message-State: AJIora9RDcE5UOdbJMkuJyKn/nV/nNa4sT9VXQoOZ4yLKS4mUcK03bvz 4bD2KuwYDsthfP/zR4E17d7BN+KiWvLNMA== X-Google-Smtp-Source: AGRyM1tz/qBmIRsRg2pt1ySbY+e7d5RTsUsAQ7mwzoIHH/ri6RmhhuoZeP7bNojFYKNgbApdDaTv3w== X-Received: by 2002:a05:6000:1862:b0:216:3c40:6708 with SMTP id d2-20020a056000186200b002163c406708mr16586201wri.101.1656410773333; Tue, 28 Jun 2022 03:06:13 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e16-20020a5d4e90000000b0021b91d1ddbfsm12914430wru.21.2022.06.28.03.06.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 03:06:12 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Glen Choo , Atharva Raykar , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v4 05/12] submodule--helper: have --require-init imply --init Date: Tue, 28 Jun 2022 12:05:27 +0200 Message-Id: X-Mailer: git-send-email 2.37.0.880.gf07d56b18ba In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Adjust code added in 0060fd1511b (clone --recurse-submodules: prevent name squatting on Windows, 2019-09-12) to have the internal --require-init option imply --init, rather than having "git-submodule.sh" add it implicitly. This change doesn't make any difference now, but eliminates another special-case where "git submodule--helper update"'s behavior was different from "git submodule update". This will make it easier to eventually replace the cmd_update() function in git-submodule.sh. We'll still need to keep the distinction between "--init" and "--require-init" in git-submodule.sh. Once cmd_update() gets re-implemented in C we'll be able to change variables and other code related to that, but not yet. Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/submodule--helper.c | 5 ++++- git-submodule.sh | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index c597df7528e..0fab3a52e88 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -2619,7 +2619,7 @@ static int module_update(int argc, const char **argv, const char *prefix) OPT_BOOL(0, "progress", &opt.progress, N_("force cloning progress")), OPT_BOOL(0, "require-init", &opt.require_init, - N_("disallow cloning into non-empty directory")), + N_("disallow cloning into non-empty directory, implies --init")), OPT_BOOL(0, "single-branch", &opt.single_branch, N_("clone only one branch, HEAD or --branch")), OPT_PARSE_LIST_OBJECTS_FILTER(&filter_options), @@ -2643,6 +2643,9 @@ static int module_update(int argc, const char **argv, const char *prefix) argc = parse_options(argc, argv, prefix, module_update_options, git_submodule_helper_usage, 0); + if (opt.require_init) + opt.init = 1; + if (filter_options.choice && !opt.init) { usage_with_options(git_submodule_helper_usage, module_update_options); diff --git a/git-submodule.sh b/git-submodule.sh index 20fc1b620fa..5b9683bf766 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -251,7 +251,6 @@ cmd_update() init=1 ;; --require-init) - init=1 require_init=1 ;; --remote) From patchwork Tue Jun 28 10:05:28 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: 12898022 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 02584C433EF for ; Tue, 28 Jun 2022 10:06:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344761AbiF1KGe (ORCPT ); Tue, 28 Jun 2022 06:06:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344723AbiF1KGU (ORCPT ); Tue, 28 Jun 2022 06:06:20 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EE402EA30 for ; Tue, 28 Jun 2022 03:06:16 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id k129so5621029wme.0 for ; Tue, 28 Jun 2022 03:06:16 -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=unuGGN27MGn/Pd8qliKYczAijAiplWFLo+NCfdXHqHg=; b=fQi/8eprrqsls9eZTUrAj1gs7HXMgoCDo2NSYlfT5RQoOOSY6M2wTJKqrRocExpdoh KTfioJmQ81vOxXbhOpLzM1CepW1k15+JWwGWqco/s1dB41ISmvIJun2CFCofYUwZMlHG pQLDM4vCfjjFa/0OTax0xC9L1VoIafBHzZicfzHXLephX9h7Ygu1hpGkImQjdLDBi907 wf6VvnkIdaIsKD+ztSXnsmunhTEKVBl5BAcntGKvds8KrKQzoWaDN5nQdtbJXHw8567/ RlmErImDcj7RwWWn41ZqBa8TEM0drcYZu08AsTl1j0sOoENSMDnU+u60vHEvoBq5DMQz tp0g== 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=unuGGN27MGn/Pd8qliKYczAijAiplWFLo+NCfdXHqHg=; b=hEphu8Bgf76HDUCEpYZfCZFg5Dl9nhm5H27Xvg2ScZUJUDcJILsRRG01pFiHriiCCv ovls/NQR5cA4vsxmlWwNFeJK8pED6HsNJjPE6s7w+iAmbS8JEgYmhvoPFDw02/l5FrQy opUzpwxrEdO3U8kUccNgnpN08yLEfjp+/Z4d2rQE65kBAtBCrY+93bKt/nU1Ct8JTszC BLuYY6+O+kLmACwrLiii8qqNe3AbEAixul3BzGPg3aAnie6dmkfWYRQplnylYIBOFV0w puiO3lWUvVdyrZGatEtBFwAhkkUVjUyv5B5o49OIfLr1IdB7Z9nioflCOKRpBfvB8KHf wLqg== X-Gm-Message-State: AJIora/E2KFRBcc4dqXKahmDJdm6bfz1q9orr+nuHNWrD+arYBwVdg8i EggcSqG0Gh+cB6b5Ufpb9U9WFYhFXOC4/g== X-Google-Smtp-Source: AGRyM1v7CS8w2W8e0LRNYDuhUi9lKh7L2wdnPFifA6+Ot3EkPAV7Os/LT1NCqMOu+hZPIpO/Nf02lg== X-Received: by 2002:a05:600c:4e92:b0:3a0:4f34:8fd6 with SMTP id f18-20020a05600c4e9200b003a04f348fd6mr5816809wmq.63.1656410774452; Tue, 28 Jun 2022 03:06:14 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e16-20020a5d4e90000000b0021b91d1ddbfsm12914430wru.21.2022.06.28.03.06.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 03:06:13 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Glen Choo , Atharva Raykar , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v4 06/12] submodule update: remove "-v" option Date: Tue, 28 Jun 2022 12:05:28 +0200 Message-Id: X-Mailer: git-send-email 2.37.0.880.gf07d56b18ba In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In e84c3cf3dc3 (git-submodule.sh: accept verbose flag in cmd_update to be non-quiet, 2018-08-14) the "git submodule update" sub-command was made to understand "-v", but the option was never documented. The only in-tree user has been this test added in 3ad0401e9e6 (submodule update: silence underlying merge/rebase with "--quiet", 2020-09-30), it wasn't per-se testing --quiet, but fixing a bug in e84c3cf3dc3: It used to set "GIT_QUIET=0" instead of unsetting it on "-v", and thus we'd end up passing "--quiet" to "git submodule--helper" on "-v", since the "--quiet" option was passed using the ${parameter:+word} construct. Furthermore, even if someone had used the "-v" option they'd only be getting the default output. Our default in both git-submodule.sh and "git submodule--helper" has been to be "verbose", so the only way this option could have matter is if it were used as e.g.: git submodule --quiet update -v [...] I.e. to undo the effect of a previous "--quiet" on the command-line. Signed-off-by: Ævar Arnfjörð Bjarmason --- git-submodule.sh | 3 --- t/t7406-submodule-update.sh | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/git-submodule.sh b/git-submodule.sh index 5b9683bf766..0df6b0fc974 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -241,9 +241,6 @@ cmd_update() -q|--quiet) GIT_QUIET=1 ;; - -v) - unset GIT_QUIET - ;; --progress) progress=1 ;; diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh index 43f779d751c..06d804e2131 100755 --- a/t/t7406-submodule-update.sh +++ b/t/t7406-submodule-update.sh @@ -1074,7 +1074,7 @@ test_expect_success 'submodule update --quiet passes quietness to merge/rebase' git submodule update --rebase --quiet >out 2>err && test_must_be_empty out && test_must_be_empty err && - git submodule update --rebase -v >out 2>err && + git submodule update --rebase >out 2>err && test_file_not_empty out && test_must_be_empty err ) From patchwork Tue Jun 28 10:05:29 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: 12898021 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 8AEE5C43334 for ; Tue, 28 Jun 2022 10:06:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344747AbiF1KGc (ORCPT ); Tue, 28 Jun 2022 06:06:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344724AbiF1KGW (ORCPT ); Tue, 28 Jun 2022 06:06:22 -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 2EF582ED4F for ; Tue, 28 Jun 2022 03:06:17 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id k129so5621050wme.0 for ; Tue, 28 Jun 2022 03:06:17 -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=xJ5k3GFPBFeVvI1cBFq2qpGOZiU2oEwih/6AYGTKNyY=; b=FsudzEALXNpKRlqnB5L4yQfSklUS5fMKud5XJTGfhAT94sV4YmzqWEjBhwL6bPR8+n fj7jeyvM2dt98xV4E7Rd7qY+fpdtlkQiICOCu9l5tAJIDm01BvTm9z9PnNKbHP4drXkR 5ikmvpQZHsnEU8AYGpPGeWb6jCdQs1twePFtQm6dCa5Y7FSE3ofFJgIuayzuoKnxFl9Z 7Y9aVwYhdVbKLQSomC0T7s20xMBmSb3IuGT1FgzabebSxJ7k442bx2jOFRpBsUnyru9M L7tgqxytjk4aRz7Dwyw+EC63A3q9hqXFu3grOM0QETnpbRGD2YLyaJxAKayXHpQUdFLD 2GcA== 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=xJ5k3GFPBFeVvI1cBFq2qpGOZiU2oEwih/6AYGTKNyY=; b=lt7HXZoLA48EmQI47Cd2mKswJWk+89/7NqEUhrVdMgiLjpzX0JfUP2CaWWGe+BxpgR 8PeavPgvhoFzpvrEjardhttlKGIUDa0als+G37YktBstjccF0jFdb4VG71Ga4WjWvMjC +Vif3dVIXSE0rZYr9PbhU+Z4h7Mupyypb6aoeU81+9waPAuof7t75BHJ048kUae4+jwP pGxerKDb2iNLqsv+io6LXPp78ALTBTljzG72agANePd/8rgrM+9mQfFDmrlr34Q3qHkg YzTBvoVZbVdB0qp3YShbRYXxYi0+YG17Mt+5ZdbUSyhYd8WAuPfji6vdDhUFbA50hO95 WQ/A== X-Gm-Message-State: AJIora/jROzfrKUO8dqit79wQ0DW4lr/lg30WFaFEH2F9iqLw1ttr68F OfyxnxvXNBtRDZ6pcIx4sK3AQRUj4Q3R2w== X-Google-Smtp-Source: AGRyM1v4dGviNSr4cpOHuq383WJeSL60Jqzx+Dqb8Ay5ZI0YIEb5zTIP1nLOLvZthMUtjqZgxAMObQ== X-Received: by 2002:a05:600c:4081:b0:3a0:47c4:8dd0 with SMTP id k1-20020a05600c408100b003a047c48dd0mr13851166wmh.178.1656410775428; Tue, 28 Jun 2022 03:06:15 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e16-20020a5d4e90000000b0021b91d1ddbfsm12914430wru.21.2022.06.28.03.06.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 03:06:14 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Glen Choo , Atharva Raykar , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v4 07/12] submodule--helper: rename "absorb-git-dirs" to "absorbgitdirs" Date: Tue, 28 Jun 2022 12:05:29 +0200 Message-Id: X-Mailer: git-send-email 2.37.0.880.gf07d56b18ba In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Rename the "absorb-git-dirs" subcommand to "absorbgitdirs", which is what the "git submodule" command itself has called it since the subcommand was implemented in f6f85861400 (submodule: add absorb-git-dir function, 2016-12-12). Having these two be different will make it more tedious to dispatch to eventually dispatch "git submodule--helper" directly, as we'd need to retain this name mapping. So let's get rid of this needless inconsistency. Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/submodule--helper.c | 4 ++-- git-submodule.sh | 2 +- submodule.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 0fab3a52e88..10223a00927 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -2788,7 +2788,7 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix) }; const char *const git_submodule_helper_usage[] = { - N_("git submodule--helper absorb-git-dirs [] [...]"), + N_("git submodule--helper absorbgitdirs [] [...]"), NULL }; @@ -3390,7 +3390,7 @@ static struct cmd_struct commands[] = { {"deinit", module_deinit, 0}, {"summary", module_summary, SUPPORT_SUPER_PREFIX}, {"push-check", push_check, 0}, - {"absorb-git-dirs", absorb_git_dirs, SUPPORT_SUPER_PREFIX}, + {"absorbgitdirs", absorb_git_dirs, SUPPORT_SUPER_PREFIX}, {"is-active", is_active, 0}, {"check-name", check_name, 0}, {"config", module_config, 0}, diff --git a/git-submodule.sh b/git-submodule.sh index 0df6b0fc974..1c1dc320922 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -552,7 +552,7 @@ cmd_sync() cmd_absorbgitdirs() { - git submodule--helper absorb-git-dirs --prefix "$wt_prefix" "$@" + git submodule--helper absorbgitdirs --prefix "$wt_prefix" "$@" } # This loop parses the command line arguments to find the diff --git a/submodule.c b/submodule.c index 4e299f578f9..2af16c647d5 100644 --- a/submodule.c +++ b/submodule.c @@ -2374,7 +2374,7 @@ void absorb_git_dir_into_superproject(const char *path, cp.no_stdin = 1; strvec_pushl(&cp.args, "--super-prefix", sb.buf, "submodule--helper", - "absorb-git-dirs", NULL); + "absorbgitdirs", NULL); prepare_submodule_repo_env(&cp.env); if (run_command(&cp)) die(_("could not recurse into submodule '%s'"), path); From patchwork Tue Jun 28 10:05:30 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: 12898020 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 98DE6C433EF for ; Tue, 28 Jun 2022 10:06:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344735AbiF1KGa (ORCPT ); Tue, 28 Jun 2022 06:06:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344733AbiF1KG0 (ORCPT ); Tue, 28 Jun 2022 06:06:26 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DE3F2DAAA for ; Tue, 28 Jun 2022 03:06:18 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id k129so5621078wme.0 for ; Tue, 28 Jun 2022 03:06:18 -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=rQV8033leCUnUqz3xdWGkYI5Ocvxb+4360H2xUio/ew=; b=OIZfS9rpzC2xUexP1FrschuKWiylZN8Bq1ZAQ6LNtBnvohioJwJYIs1qAgBonxslVS a5GJ3wIukC8pgC/6Jmvcs7Er8kvAKpDLNXrrekd1HH4fhWw8iP1jMxFM01b6ymrSHspO S9nJyQNT60Vx5wTevwZNYcNayZb+WxkY8rxoUTCd3ge8B5NO4ynp5nMOi1tScsIonsC9 2wk5jHo3aSUPnm8qqvaKUEDY+lqDonESNOKTGo8u63u/fA9a/WjWU5Y1aj84UkFo/dbU RY02rZJWydlErYGwTkJjQKwXaIb89tPLtgwYMZb/t2sd5unq+WsS0E8x5QoSpRMZMkuL r6Kg== 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=rQV8033leCUnUqz3xdWGkYI5Ocvxb+4360H2xUio/ew=; b=HI1HFL0p9jaHaZZIJB9SsTWHHGRqCg/HBT+l4rQR+KmcNZAXCJCVrZ04IZkOztJMhV rWGiDsDuO2VrBDqW55Sq47IDqXCaVEeaHfI0rAYX2UXaMAmcFlZ3qYLbWQjkNCfdg4oy CCLSEFs+xoWweEiSjn7B4GtTML1pSnOGn/4V0bMyOd21Y6YXpDzEUcrws/bWyppqBEEG BOjLmZNnM+qefWFOzxtiT703OSKNkD9ptKi5QQ/YkSImMLKZAuP1/Dz9tyPgz+YlXEYj 3ZMqnkNcKzh9Tna/k0AZiTk4MKwQr+bVLKhgeEHQvku98josdoWyAJx71urH7A5Gke2c drCQ== X-Gm-Message-State: AJIora/cmrCU8deV6ZVIAP/y7M9DtHL3RlIi5loJGOqO4fSgkf0PgVrk 5N4K/tCitFz56F0YilZCZhzVcPdSP+R17w== X-Google-Smtp-Source: AGRyM1tFe+RhItiYZ4lmOZjjsloHGK0MtsGoFUFVNgL1yvXpOD0NnPWudi/k9411pup2WHwEJzdpPw== X-Received: by 2002:a05:600c:3d16:b0:39e:f07b:77a5 with SMTP id bh22-20020a05600c3d1600b0039ef07b77a5mr24683252wmb.140.1656410776388; Tue, 28 Jun 2022 03:06:16 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e16-20020a5d4e90000000b0021b91d1ddbfsm12914430wru.21.2022.06.28.03.06.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 03:06:15 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Glen Choo , Atharva Raykar , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v4 08/12] submodule--helper: report "submodule" as our name in some "-h" output Date: Tue, 28 Jun 2022 12:05:30 +0200 Message-Id: X-Mailer: git-send-email 2.37.0.880.gf07d56b18ba In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change the user-facing "git submodule--helper" commands so that they'll report their name as being "git submodule". To a user these commands are internal implementation details, and it doesn't make sense to emit usage about an internal helper when "git submodule" is invoked with invalid options. Before this we'd emit e.g.: $ git submodule absorbgitdirs --blah error: unknown option `blah' usage: git submodule--helper absorbgitdirs [] [...] [...] And: $ git submodule set-url -- -- usage: git submodule--helper set-url [--quiet] [...] Now we'll start with "usage: git submodule [...]" in both of those cases. This change does not alter the "list", "name", "clone", "config" and "create-branch" commands, those are internal-only (as an aside; their usage info should probably invoke BUG(...)). This only changes the user-facing commands. The "status", "deinit" and "update" commands are not included in this change, because their usage information already used "submodule" rather than "submodule--helper". I don't think it's currently possible to emit some of this usage information in practice, as git-submodule.sh will catch unknown options, and e.g. it doesn't seem to be possible to get "add" to emit its usage information from "submodule--helper". Though that change may be superfluous now, it's also harmless, and will allow us to eventually dispatch further into "git submodule--helper" from git-submodule.sh, while emitting the correct usage output. Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/submodule--helper.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 10223a00927..d145d53addd 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -444,7 +444,7 @@ static int module_foreach(int argc, const char **argv, const char *prefix) }; const char *const git_submodule_helper_usage[] = { - N_("git submodule--helper foreach [--quiet] [--recursive] [--] "), + N_("git submodule foreach [--quiet] [--recursive] [--] "), NULL }; @@ -582,7 +582,7 @@ static int module_init(int argc, const char **argv, const char *prefix) }; const char *const git_submodule_helper_usage[] = { - N_("git submodule--helper init [] []"), + N_("git submodule init [] []"), NULL }; @@ -1185,7 +1185,7 @@ static int module_summary(int argc, const char **argv, const char *prefix) }; const char *const git_submodule_helper_usage[] = { - N_("git submodule--helper summary [] [] [--] []"), + N_("git submodule summary [] [] [--] []"), NULL }; @@ -1349,7 +1349,7 @@ static int module_sync(int argc, const char **argv, const char *prefix) }; const char *const git_submodule_helper_usage[] = { - N_("git submodule--helper sync [--quiet] [--recursive] []"), + N_("git submodule sync [--quiet] [--recursive] []"), NULL }; @@ -2788,7 +2788,7 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix) }; const char *const git_submodule_helper_usage[] = { - N_("git submodule--helper absorbgitdirs [] [...]"), + N_("git submodule absorbgitdirs [] [...]"), NULL }; @@ -2893,7 +2893,7 @@ static int module_set_url(int argc, const char **argv, const char *prefix) OPT_END() }; const char *const usage[] = { - N_("git submodule--helper set-url [--quiet] "), + N_("git submodule set-url [--quiet] "), NULL }; @@ -2932,8 +2932,8 @@ static int module_set_branch(int argc, const char **argv, const char *prefix) OPT_END() }; const char *const usage[] = { - N_("git submodule--helper set-branch [-q|--quiet] (-d|--default) "), - N_("git submodule--helper set-branch [-q|--quiet] (-b|--branch) "), + N_("git submodule set-branch [-q|--quiet] (-d|--default) "), + N_("git submodule set-branch [-q|--quiet] (-b|--branch) "), NULL }; @@ -3277,7 +3277,7 @@ static int module_add(int argc, const char **argv, const char *prefix) }; const char *const usage[] = { - N_("git submodule--helper add [] [--] []"), + N_("git submodule add [] [--] []"), NULL }; From patchwork Tue Jun 28 10:05:31 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: 12898028 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 BAB99C433EF for ; Tue, 28 Jun 2022 10:06:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344775AbiF1KGo (ORCPT ); Tue, 28 Jun 2022 06:06:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344750AbiF1KG2 (ORCPT ); Tue, 28 Jun 2022 06:06:28 -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 550FD2ED78 for ; Tue, 28 Jun 2022 03:06:19 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id r20so16938536wra.1 for ; Tue, 28 Jun 2022 03:06: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=lLeJQnYqv82yoLR9KK54RSC0KTbCHFAyeRz/NxYaLis=; b=Et+MT18qDu6hUSXChgmBo1F6/XW2hu7n1kJMCxZrWlch4VjGqL9eCCCysOZ5X0g5wQ GAii2xk3JhyUbyWQ/yptIaN/32mm2B4Z4V13jSWngOOH/Ep+LFs6/22s/3kJ2I3BTVSO mbgJ+BlOL1eO6epzne0aJ208hiqUoWKSFZx8f/juya6xVLxbPrercWKa62wXR/6E33sT 0dyezHN0uY1JHZA6NY4QtU9NCL6VvfzsB2vyumzG90NeofcK+VBUj2b6MCQXLpmmS8Gd QtmbSuJ/onUWAVik2jGwoaqe6oa8tfx2Dj8rd5YfJeUkjLem8B65sr/Tmtr/SunHzLRO Tqdw== 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=lLeJQnYqv82yoLR9KK54RSC0KTbCHFAyeRz/NxYaLis=; b=4HE+7G/YDyNpXe9rrUgjQQK9n+wBUyPVQQ6i7H/GF3XhHN2cUUUgBaCb/2aKvKFCxB rmYdu9Glr+1VHaYbiclYpcGk/4YdwQhkld4+7wQyMH7Lf4TJYuut1l8DUP6w5rxxGm49 QZrbjjuFQM6iskGO/DRJcmr3Og/F+e8TyzAmv5P5HAw5/CLAbc/6/wH5hCnE5Ed/sE3r aRlr8G3vUQ83sn4JtzGMqxGG6HEHe88jZsHVwMl4Jr2VK+fTHoqHkFW/8/9ujfOxaH0S 2llUs3aazJV381uB6TG5sBtV1RFa3LJwNqdvoTEIOPrGhiQNTjr6fbyELNxGK/qIwR/B S3KQ== X-Gm-Message-State: AJIora8qcOYmsCj6kZmNvofiaynhYYStQSvfxEYsODVR7fA2aDpIDz6M OmLGTtLaI7fWJ4FaTcCNj8LKpS1Jrgme6g== X-Google-Smtp-Source: AGRyM1tC5LzsYPUotndROx/FQDRcqdDTz+TcF2SvwT+Cro1T21Mj5QyWI7kaKVj9LYCUa4Q2St5RDg== X-Received: by 2002:adf:ffcf:0:b0:21a:3cc0:d624 with SMTP id x15-20020adfffcf000000b0021a3cc0d624mr16942514wrs.164.1656410777524; Tue, 28 Jun 2022 03:06:17 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e16-20020a5d4e90000000b0021b91d1ddbfsm12914430wru.21.2022.06.28.03.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 03:06:16 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Glen Choo , Atharva Raykar , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v4 09/12] submodule--helper: understand --checkout, --merge and --rebase synonyms Date: Tue, 28 Jun 2022 12:05:31 +0200 Message-Id: X-Mailer: git-send-email 2.37.0.880.gf07d56b18ba In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Understand --checkout, --merge and --rebase synonyms for --update={checkout,merge,rebase}, as well as the short options that 'git submodule' itself understands. This removes a difference between the CLI API of "git submodule" and "git submodule--helper", making it easier to make the latter an alias for the former. See 48308681b07 (git submodule update: have a dedicated helper for cloning, 2016-02-29) for the initial addition of --update. Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/submodule--helper.c | 30 ++++++++++++++++++++++++++++++ git-submodule.sh | 14 +++++++++----- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index d145d53addd..e35ae0322ee 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -2405,6 +2405,23 @@ static void ensure_core_worktree(const char *path) } } +static const char *submodule_update_type_to_label(enum submodule_update_type type) +{ + switch (type) { + case SM_UPDATE_CHECKOUT: + return "checkout"; + case SM_UPDATE_MERGE: + return "merge"; + case SM_UPDATE_REBASE: + return "rebase"; + case SM_UPDATE_UNSPECIFIED: + case SM_UPDATE_NONE: + case SM_UPDATE_COMMAND: + break; + } + BUG("unreachable with type %d", type); +} + static void update_data_to_args(struct update_data *update_data, struct strvec *args) { strvec_pushl(args, "submodule--helper", "update", "--recursive", NULL); @@ -2583,6 +2600,7 @@ static int module_update(int argc, const char **argv, const char *prefix) struct update_data opt = UPDATE_DATA_INIT; struct list_objects_filter_options filter_options; int ret; + enum submodule_update_type update_type = SM_UPDATE_UNSPECIFIED; struct option module_update_options[] = { OPT__FORCE(&opt.force, N_("force checkout updates"), 0), @@ -2604,6 +2622,15 @@ static int module_update(int argc, const char **argv, const char *prefix) OPT_STRING(0, "update", &opt.update_default, N_("string"), N_("rebase, merge, checkout or none")), + OPT_SET_INT(0, "checkout", &update_type, + N_("use the 'checkout' update strategy (default)"), + SM_UPDATE_CHECKOUT), + OPT_SET_INT('m', "merge", &update_type, + N_("use the 'merge' update strategy"), + SM_UPDATE_MERGE), + OPT_SET_INT('r', "rebase", &update_type, + N_("use the 'rebase' update strategy"), + SM_UPDATE_REBASE), OPT_STRING_LIST(0, "reference", &opt.references, N_("repo"), N_("reference repository")), OPT_BOOL(0, "dissociate", &opt.dissociate, @@ -2653,6 +2680,9 @@ static int module_update(int argc, const char **argv, const char *prefix) opt.filter_options = &filter_options; + if (update_type != SM_UPDATE_UNSPECIFIED) + opt.update_default = submodule_update_type_to_label(update_type); + if (opt.update_default) if (parse_submodule_update_strategy(opt.update_default, &opt.update_strategy) < 0) diff --git a/git-submodule.sh b/git-submodule.sh index 1c1dc320922..7fc7119fb21 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -40,7 +40,9 @@ require_init= files= remote= nofetch= -update= +rebase= +merge= +checkout= custom_name= depth= progress= @@ -260,7 +262,7 @@ cmd_update() force=$1 ;; -r|--rebase) - update="rebase" + rebase=1 ;; --reference) case "$2" in '') usage ;; esac @@ -274,13 +276,13 @@ cmd_update() dissociate=1 ;; -m|--merge) - update="merge" + merge=1 ;; --recursive) recursive=1 ;; --checkout) - update="checkout" + checkout=1 ;; --recommend-shallow) recommend_shallow="--recommend-shallow" @@ -341,7 +343,9 @@ cmd_update() ${init:+--init} \ ${nofetch:+--no-fetch} \ ${wt_prefix:+--prefix "$wt_prefix"} \ - ${update:+--update "$update"} \ + ${rebase:+--rebase} \ + ${merge:+--merge} \ + ${checkout:+--checkout} \ ${reference:+"$reference"} \ ${dissociate:+"--dissociate"} \ ${depth:+"$depth"} \ From patchwork Tue Jun 28 10:05:32 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: 12898026 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 6F5F0CCA479 for ; Tue, 28 Jun 2022 10:06:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344771AbiF1KGj (ORCPT ); Tue, 28 Jun 2022 06:06:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344753AbiF1KG2 (ORCPT ); Tue, 28 Jun 2022 06:06:28 -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 63DE21DA63 for ; Tue, 28 Jun 2022 03:06:20 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id o16so16932218wra.4 for ; Tue, 28 Jun 2022 03:06: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=qnsvt39/xZsKKhJReg6zKy+vtczVM86rKiqEn0MU3vc=; b=EMi2VK5UoyEvIsfZbdRSqqtgXyNlpLg6hPZ7O95IznyVqs8wqmn6h0rts3TUr21cCd L0usukK1Qre/2Xw+JzE4Qp/39mopVKsUDrBsKuhmdEJr8iBwCVkXqlF5KwZx5yDtvHPI 05Hc0sW1kHtap+jMDKBSEnNnfhvS3OqW6NqkqRkwKHL9nuyCiR6klESGj11IOK/h1UTx u51Z6UovdXlBoh8udIK5q8Rw9rWy2ZZcu6CShH627ZvI8x+lNUM0tz1J8NjlBzh2x6Y7 +PiAqyaRPi+8M9ValKv0tOhTMxrjBRwtVRPZHhcS68Y7uWvMutSQY/RLV4Sd5rSfHYpm CLWA== 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=qnsvt39/xZsKKhJReg6zKy+vtczVM86rKiqEn0MU3vc=; b=O6TRDbwon8u/uk3dtE5ZklkvtCpZMVaoLV3aIjWJu7iy2HRT8HBQBsiFNS8NEBQpfE zE+lQ/rtI12tDH1GuHU0GyzuthrAx/vzsZ/m8C9CzQlulSS9EOpMMd8B8pBaInAbnyWv gvjz57AGoe6xZofJpEJlTLFp61OXOVGcGwJ8VqTXt9iQTDtU1EbV2SA0dZ7iKeuzkv7g 5DwvMNuBpMWRKzxEptCOlWOIBcjbFrbYD2kXEz/FEThyqHeTduzuraSZqIcAxG+XYbI6 dnurgtJsQT8PLnaiW0Cp9YYKxY6V/F+W0W53zjz6Vij+aitaodPxJ8iVC6T4K4uoNTAi ZZeA== X-Gm-Message-State: AJIora8nTLtfr1VOLxmgDySqnAe6HlyaB9BJXEV9VOfCx8mv2qk7IeXj L3gFTibnTaTadfTphjjG35rZFvFirKdvmQ== X-Google-Smtp-Source: AGRyM1sjsJSOcbRvajluNZLW/C4BPuYxBbeuV8+SkN5PZ7pv7Q3Zxl8O6FMT8Sg7IWpNk5o5iJiZzA== X-Received: by 2002:adf:ea91:0:b0:21a:3d15:ae17 with SMTP id s17-20020adfea91000000b0021a3d15ae17mr17329937wrm.486.1656410778614; Tue, 28 Jun 2022 03:06:18 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e16-20020a5d4e90000000b0021b91d1ddbfsm12914430wru.21.2022.06.28.03.06.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 03:06:17 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Glen Choo , Atharva Raykar , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v4 10/12] submodule--helper: eliminate internal "--update" option Date: Tue, 28 Jun 2022 12:05:32 +0200 Message-Id: X-Mailer: git-send-email 2.37.0.880.gf07d56b18ba In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Glen Choo Follow-up on the preceding commit which taught "git submodule--helper update" to understand "--merge", "--checkout" and "--rebase" and use those options instead of "--update=(rebase|merge|checkout|none)" when the command invokes itself. Unlike the preceding change this isn't strictly necessary to eventually change "git-submodule.sh" so that it invokes "git submodule--helper update" directly, but let's remove this inconsistency in the command-line interface. We shouldn't need to carry special synonyms for existing options in "git submodule--helper" when that command can use the primary documented names instead. But, as seen in the post-image this makes the control flow within "builtin/submodule--helper.c" simpler, we can now write directly to the "update_default" member of "struct update_data" when parsing the options in "module_update()". Signed-off-by: Glen Choo Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/submodule--helper.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index e35ae0322ee..d60f6cd9de0 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -1818,7 +1818,7 @@ static int module_clone(int argc, const char **argv, const char *prefix) static void determine_submodule_update_strategy(struct repository *r, int just_cloned, const char *path, - const char *update, + enum submodule_update_type update, struct submodule_update_strategy *out) { const struct submodule *sub = submodule_from_path(r, null_oid(), path); @@ -1828,9 +1828,7 @@ static void determine_submodule_update_strategy(struct repository *r, key = xstrfmt("submodule.%s.update", sub->name); if (update) { - if (parse_submodule_update_strategy(update, out) < 0) - die(_("Invalid update mode '%s' for submodule path '%s'"), - update, path); + out->type = update; } else if (!repo_config_get_string_tmp(r, key, &val)) { if (parse_submodule_update_strategy(val, out) < 0) die(_("Invalid update mode '%s' configured for submodule path '%s'"), @@ -1882,7 +1880,7 @@ struct update_data { const char *prefix; const char *recursive_prefix; const char *displaypath; - const char *update_default; + enum submodule_update_type update_default; struct object_id suboid; struct string_list references; struct submodule_update_strategy update_strategy; @@ -2424,6 +2422,8 @@ static const char *submodule_update_type_to_label(enum submodule_update_type typ static void update_data_to_args(struct update_data *update_data, struct strvec *args) { + enum submodule_update_type update_type = update_data->update_default; + strvec_pushl(args, "submodule--helper", "update", "--recursive", NULL); strvec_pushf(args, "--jobs=%d", update_data->max_jobs); if (update_data->recursive_prefix) @@ -2447,8 +2447,10 @@ static void update_data_to_args(struct update_data *update_data, struct strvec * strvec_push(args, "--require-init"); if (update_data->depth) strvec_pushf(args, "--depth=%d", update_data->depth); - if (update_data->update_default) - strvec_pushl(args, "--update", update_data->update_default, NULL); + if (update_type != SM_UPDATE_UNSPECIFIED) + strvec_pushf(args, "--%s", + submodule_update_type_to_label(update_type)); + if (update_data->references.nr) { struct string_list_item *item; for_each_string_list_item(item, &update_data->references) @@ -2600,7 +2602,6 @@ static int module_update(int argc, const char **argv, const char *prefix) struct update_data opt = UPDATE_DATA_INIT; struct list_objects_filter_options filter_options; int ret; - enum submodule_update_type update_type = SM_UPDATE_UNSPECIFIED; struct option module_update_options[] = { OPT__FORCE(&opt.force, N_("force checkout updates"), 0), @@ -2619,16 +2620,13 @@ static int module_update(int argc, const char **argv, const char *prefix) N_("path"), N_("path into the working tree, across nested " "submodule boundaries")), - OPT_STRING(0, "update", &opt.update_default, - N_("string"), - N_("rebase, merge, checkout or none")), - OPT_SET_INT(0, "checkout", &update_type, + OPT_SET_INT(0, "checkout", &opt.update_default, N_("use the 'checkout' update strategy (default)"), SM_UPDATE_CHECKOUT), - OPT_SET_INT('m', "merge", &update_type, + OPT_SET_INT('m', "merge", &opt.update_default, N_("use the 'merge' update strategy"), SM_UPDATE_MERGE), - OPT_SET_INT('r', "rebase", &update_type, + OPT_SET_INT('r', "rebase", &opt.update_default, N_("use the 'rebase' update strategy"), SM_UPDATE_REBASE), OPT_STRING_LIST(0, "reference", &opt.references, N_("repo"), @@ -2680,13 +2678,8 @@ static int module_update(int argc, const char **argv, const char *prefix) opt.filter_options = &filter_options; - if (update_type != SM_UPDATE_UNSPECIFIED) - opt.update_default = submodule_update_type_to_label(update_type); - if (opt.update_default) - if (parse_submodule_update_strategy(opt.update_default, - &opt.update_strategy) < 0) - die(_("bad value for update parameter")); + opt.update_strategy.type = opt.update_default; if (module_list_compute(argc, argv, prefix, &pathspec, &opt.list) < 0) { list_objects_filter_release(&filter_options); From patchwork Tue Jun 28 10:05:33 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: 12898027 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 E70F6C433EF for ; Tue, 28 Jun 2022 10:06:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344757AbiF1KGl (ORCPT ); Tue, 28 Jun 2022 06:06:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344752AbiF1KG2 (ORCPT ); Tue, 28 Jun 2022 06:06:28 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B83E2F00A for ; Tue, 28 Jun 2022 03:06:21 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id i67-20020a1c3b46000000b003a03567d5e9so7454071wma.1 for ; Tue, 28 Jun 2022 03:06: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=dgP7+fSKm9lVlQHw/B6sEH49pbaJKzMrWPmZobYbrJo=; b=C8UkH69dgoda81nlqvpxBgACoK7l880aNSgym758D/Prz2DLrzzocLbRjmVjE2tSFD z/uxovx55jwM0QUxczqi6AHQmTJ80ElORTvpagTJCpOnX3w4xjZGrAjQHTb8EWKZQMeu GptFaZC+6cYqjkajHsVTT8sCA4Rtbq7LHDoFt7EmbG2e9OFkK+Ckj9o25CUG0gSLhXhK NlWYs7v5gqpOl9JhCzJDrSQf3VggqYHW8Mo3VOEuifbZ800N0z4ntkuvT/DMfnHdywSz osH3c+2Mm5tJnU4ULhhbeQHe2E0xGnTJ3Y7nUAxwJB7SxiKBZgJUVvBm2JhF8eDtfm62 S0fA== 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=dgP7+fSKm9lVlQHw/B6sEH49pbaJKzMrWPmZobYbrJo=; b=ReSAm1AC7yHlxQs0rYnLtgz3JwkOKmR5CrSKy5E0T12urlNzPQNPqeHwbG0UlOc0D8 yTAxjzmg/zF71gKByzC3jEQVYMn3MIB40nqme4Cg18XYUvSqLU+gtrBH+wmO37UDwXUt SQjURlZywHZtGN+OQfbTdBtgg4VYkP5eLVu3oUVIV5F+L/9Qg1nuY+i+r+/sEkBO2+M7 heR+gUJmKhWscRro/9um0/Itw6fHJUIC0dqL/x9MVa7UMB0oUzPRH76p1Yjyqn4+g6W9 roglBP7Gk+vWnQamdD3rHpl5vNQZhi05NxGVK9D2QpwEsYpHEijSDzUuAyIcDce7Oki9 9ACw== X-Gm-Message-State: AJIora86ez/4UGY0en5zv5sdz5NS1h7mtws6WwXnSyVM20FL5Ibza9YW CL61OGXWkKxP5H1CgkSNy5rZMYhSbYx9oQ== X-Google-Smtp-Source: AGRyM1sbVpjkGHJnektRwxfBVhy4Qf++l0kedt4yjXfWjbezc6PAPJNUB0nYQ6lt9pKdSqA7HT9gog== X-Received: by 2002:a05:600c:2051:b0:3a0:3c58:6ff6 with SMTP id p17-20020a05600c205100b003a03c586ff6mr23734967wmg.98.1656410779694; Tue, 28 Jun 2022 03:06:19 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e16-20020a5d4e90000000b0021b91d1ddbfsm12914430wru.21.2022.06.28.03.06.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 03:06:18 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Glen Choo , Atharva Raykar , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v4 11/12] git-submodule.sh: use "$quiet", not "$GIT_QUIET" Date: Tue, 28 Jun 2022 12:05:33 +0200 Message-Id: X-Mailer: git-send-email 2.37.0.880.gf07d56b18ba In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Remove the use of the "$GIT_QUIET" variable in favor of our own "$quiet", ever since b3c5f5cb048 (submodule: move core cmd_update() logic to C, 2022-03-15) we have not used the "say" function in git-sh-setup.sh, which is the only thing that's affected by using "GIT_QUIET". We still want to support --quiet for our own use though, but let's use our own variable for that. Now it's obvious that we only care about passing "--quiet" to "git submodule--helper", and not to change the output of any "say" invocation. Signed-off-by: Ævar Arnfjörð Bjarmason --- git-submodule.sh | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/git-submodule.sh b/git-submodule.sh index 7fc7119fb21..5e5d21c010f 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -30,6 +30,7 @@ GIT_PROTOCOL_FROM_USER=0 export GIT_PROTOCOL_FROM_USER command= +quiet= branch= force= reference= @@ -80,7 +81,7 @@ cmd_add() force=$1 ;; -q|--quiet) - GIT_QUIET=1 + quiet=1 ;; --progress) progress=1 @@ -128,7 +129,7 @@ cmd_add() usage fi - git ${wt_prefix:+-C "$wt_prefix"} submodule--helper add ${GIT_QUIET:+--quiet} ${force:+--force} ${progress:+"--progress"} ${branch:+--branch "$branch"} ${reference_path:+--reference "$reference_path"} ${dissociate:+--dissociate} ${custom_name:+--name "$custom_name"} ${depth:+"$depth"} -- "$@" + git ${wt_prefix:+-C "$wt_prefix"} submodule--helper add ${quiet:+--quiet} ${force:+--force} ${progress:+"--progress"} ${branch:+--branch "$branch"} ${reference_path:+--reference "$reference_path"} ${dissociate:+--dissociate} ${custom_name:+--name "$custom_name"} ${depth:+"$depth"} -- "$@" } # @@ -144,7 +145,7 @@ cmd_foreach() do case "$1" in -q|--quiet) - GIT_QUIET=1 + quiet=1 ;; --recursive) recursive=1 @@ -159,7 +160,7 @@ cmd_foreach() shift done - git ${wt_prefix:+-C "$wt_prefix"} submodule--helper foreach ${GIT_QUIET:+--quiet} ${recursive:+--recursive} -- "$@" + git ${wt_prefix:+-C "$wt_prefix"} submodule--helper foreach ${quiet:+--quiet} ${recursive:+--recursive} -- "$@" } # @@ -174,7 +175,7 @@ cmd_init() do case "$1" in -q|--quiet) - GIT_QUIET=1 + quiet=1 ;; --) shift @@ -190,7 +191,7 @@ cmd_init() shift done - git ${wt_prefix:+-C "$wt_prefix"} submodule--helper init ${GIT_QUIET:+--quiet} -- "$@" + git ${wt_prefix:+-C "$wt_prefix"} submodule--helper init ${quiet:+--quiet} -- "$@" } # @@ -207,7 +208,7 @@ cmd_deinit() force=$1 ;; -q|--quiet) - GIT_QUIET=1 + quiet=1 ;; --all) deinit_all=t @@ -226,7 +227,7 @@ cmd_deinit() shift done - git ${wt_prefix:+-C "$wt_prefix"} submodule--helper deinit ${GIT_QUIET:+--quiet} ${force:+--force} ${deinit_all:+--all} -- "$@" + git ${wt_prefix:+-C "$wt_prefix"} submodule--helper deinit ${quiet:+--quiet} ${force:+--force} ${deinit_all:+--all} -- "$@" } # @@ -241,7 +242,7 @@ cmd_update() do case "$1" in -q|--quiet) - GIT_QUIET=1 + quiet=1 ;; --progress) progress=1 @@ -335,7 +336,7 @@ cmd_update() done git ${wt_prefix:+-C "$wt_prefix"} submodule--helper update \ - ${GIT_QUIET:+--quiet} \ + ${quiet:+--quiet} \ ${force:+--force} \ ${progress:+"--progress"} \ ${remote:+--remote} \ @@ -396,7 +397,7 @@ cmd_set_branch() { shift done - git ${wt_prefix:+-C "$wt_prefix"} submodule--helper set-branch ${GIT_QUIET:+--quiet} ${branch:+--branch "$branch"} ${default:+--default} -- "$@" + git ${wt_prefix:+-C "$wt_prefix"} submodule--helper set-branch ${quiet:+--quiet} ${branch:+--branch "$branch"} ${default:+--default} -- "$@" } # @@ -409,7 +410,7 @@ cmd_set_url() { do case "$1" in -q|--quiet) - GIT_QUIET=1 + quiet=1 ;; --) shift @@ -425,7 +426,7 @@ cmd_set_url() { shift done - git ${wt_prefix:+-C "$wt_prefix"} submodule--helper set-url ${GIT_QUIET:+--quiet} -- "$@" + git ${wt_prefix:+-C "$wt_prefix"} submodule--helper set-url ${quiet:+--quiet} -- "$@" } # @@ -496,7 +497,7 @@ cmd_status() do case "$1" in -q|--quiet) - GIT_QUIET=1 + quiet=1 ;; --cached) cached=1 @@ -518,7 +519,7 @@ cmd_status() shift done - git ${wt_prefix:+-C "$wt_prefix"} submodule--helper status ${GIT_QUIET:+--quiet} ${cached:+--cached} ${recursive:+--recursive} -- "$@" + git ${wt_prefix:+-C "$wt_prefix"} submodule--helper status ${quiet:+--quiet} ${cached:+--cached} ${recursive:+--recursive} -- "$@" } # # Sync remote urls for submodules @@ -531,7 +532,7 @@ cmd_sync() do case "$1" in -q|--quiet) - GIT_QUIET=1 + quiet=1 shift ;; --recursive) @@ -551,7 +552,7 @@ cmd_sync() esac done - git ${wt_prefix:+-C "$wt_prefix"} submodule--helper sync ${GIT_QUIET:+--quiet} ${recursive:+--recursive} -- "$@" + git ${wt_prefix:+-C "$wt_prefix"} submodule--helper sync ${quiet:+--quiet} ${recursive:+--recursive} -- "$@" } cmd_absorbgitdirs() @@ -572,7 +573,7 @@ do command=$1 ;; -q|--quiet) - GIT_QUIET=1 + quiet=1 ;; --cached) cached=1 From patchwork Tue Jun 28 10:05:34 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: 12898023 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 97BE0C43334 for ; Tue, 28 Jun 2022 10:06:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344764AbiF1KGg (ORCPT ); Tue, 28 Jun 2022 06:06:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344741AbiF1KG2 (ORCPT ); Tue, 28 Jun 2022 06:06:28 -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 6ECF82E9E1 for ; Tue, 28 Jun 2022 03:06:22 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id n1so16877866wrg.12 for ; Tue, 28 Jun 2022 03:06: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=c61ciYxPKYhdTlmclwFq+h1XrzaT0dRndfQht84ZoWU=; b=A2NCKLqfalQzWvFsOfhflKp/Bf1JpRfIiP67ePYpVn/Gx9dHNIuEN7HCdSFFaDxlKr vsOQBwTfWwfoTflZ52whP9IOHdX0ytaZzHJRJ/8kLxR6bzPAtyHu9urhsMKqO8Ta1dk7 W4xVKuw0CXLoU/PFEDK+xpg3rr14RVVf1wZeeKzoVlo3VvjoKaiRpbJF1AeZDqEUMbjL JAliZI/C1dXnc3it8TJCQGDrngSrkoUz4A7qLocs7OlHph2Kr9GW2gLCTTDuOdJixTDo Ra/U9iEltybFmFGKat1oMAWNpgpDqSimMibTBLn2GKPQpP4spbOLDRe1VZywccgue7FN 1zgA== 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=c61ciYxPKYhdTlmclwFq+h1XrzaT0dRndfQht84ZoWU=; b=YEHYh66sqorGd7jpZuhtn/ZMpijz5PAaWrGBy+PweUo0OuQUIN4I1lYAW4AGcBKxA7 NC1C9DVYj7h9BV6fZ8yWTVj358ODu9Cl+JPbu+tZ0z5EEGKmI1Itt/M5U+H8Y4/hHD5O w9J0czhemi9jKqVV2HwYA2yVMQuxMpXveEGDBVDR7+9lv+AyzBAVnr6yD43zL5RnnsdQ gVVRo48LwTUCdn7ZhFug95cBlZOZSElXET3qKqXzs40DiwDQ2y47KMs8FxgHiygLVubo uE4T2m1wgynbFEZdxgQmsvSkBEVA7NFzM0wvLdYhGlbe7ESJOf0dRwHopUguMu1CRYY9 +9BA== X-Gm-Message-State: AJIora8ABxi8MyQpBSwFM7RsZ83mdanb4gtU7dCw+BX7uMEoi8P/Ngxy Baqs9gvq4Hv5D731Hn5b8tgspYGX77e8WA== X-Google-Smtp-Source: AGRyM1vNdevjf1GTfp5Roej6O2Ip8WHt0Bn/x23UdbcvwGLXbL5O0rtRgZcUhzTKP7WZmnXhN6ykCg== X-Received: by 2002:adf:e196:0:b0:219:f3c7:fd88 with SMTP id az22-20020adfe196000000b00219f3c7fd88mr16500311wrb.402.1656410780616; Tue, 28 Jun 2022 03:06:20 -0700 (PDT) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id e16-20020a5d4e90000000b0021b91d1ddbfsm12914430wru.21.2022.06.28.03.06.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 03:06:19 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Glen Choo , Atharva Raykar , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH v4 12/12] git-sh-setup.sh: remove "say" function, change last users Date: Tue, 28 Jun 2022 12:05:34 +0200 Message-Id: X-Mailer: git-send-email 2.37.0.880.gf07d56b18ba In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Remove the "say" function, with various rewrites of the remaining git-*.sh code to C and the preceding change to have git-submodule.sh stop using the GIT_QUIET variable there were only four uses in git-subtree.sh. Let's have it use an "arg_quiet" variable instead, and move the "say" function over to it. The only other use was a trivial message in git-instaweb.sh, since it has never supported the --quiet option (or similar) that code added in 0b624b4ceee (instaweb: restart server if already running, 2009-11-22) can simply use "echo" instead. The remaining in-tree hits from "say" are all for the sibling function defined in t/test-lib.sh. It's safe to remove this function since it has never been documented in Documentation/git-sh-setup.txt. Signed-off-by: Ævar Arnfjörð Bjarmason --- contrib/subtree/git-subtree.sh | 15 ++++++++++++--- git-instaweb.sh | 2 +- git-sh-setup.sh | 9 --------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index 1af1d9653e9..7562a395c24 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -50,6 +50,14 @@ m,message= use the given message as the commit message for the merge commit indent=0 +# Usage: say [MSG...] +say () { + if test -z "$arg_quiet" + then + printf '%s\n' "$*" + fi +} + # Usage: debug [MSG...] debug () { if test -n "$arg_debug" @@ -60,7 +68,7 @@ debug () { # Usage: progress [MSG...] progress () { - if test -z "$GIT_QUIET" + if test -z "$arg_quiet" then if test -z "$arg_debug" then @@ -146,6 +154,7 @@ main () { eval "$set_args" # Begin "real" flag parsing. + arg_quiet= arg_debug= arg_prefix= arg_split_branch= @@ -161,7 +170,7 @@ main () { case "$opt" in -q) - GIT_QUIET=1 + arg_quiet=1 ;; -d) arg_debug=1 @@ -252,7 +261,7 @@ main () { dir="$(dirname "$arg_prefix/.")" debug "command: {$arg_command}" - debug "quiet: {$GIT_QUIET}" + debug "quiet: {$arg_quiet}" debug "dir: {$dir}" debug "opts: {$*}" debug diff --git a/git-instaweb.sh b/git-instaweb.sh index 4349566c891..c68f49454cd 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -102,7 +102,7 @@ resolve_full_httpd () { start_httpd () { if test -f "$fqgitdir/pid"; then - say "Instance already running. Restarting..." + echo "Instance already running. Restarting..." stop_httpd fi diff --git a/git-sh-setup.sh b/git-sh-setup.sh index ecb60d9e3cb..ce273fe0e48 100644 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -57,15 +57,6 @@ die_with_status () { exit "$status" } -GIT_QUIET= - -say () { - if test -z "$GIT_QUIET" - then - printf '%s\n' "$*" - fi -} - if test -n "$OPTIONS_SPEC"; then usage() { "$0" -h