From patchwork Wed May 10 12:34:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13236893 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 AF0F4C77B7C for ; Wed, 10 May 2023 12:34:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236673AbjEJMeL (ORCPT ); Wed, 10 May 2023 08:34:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232073AbjEJMeK (ORCPT ); Wed, 10 May 2023 08:34:10 -0400 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 215C15FCA for ; Wed, 10 May 2023 05:34:09 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 465313200918; Wed, 10 May 2023 08:34:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 10 May 2023 08:34:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1683722047; x=1683808447; bh=s9 i+8tJEWLPvYCzjqsdGvO5pKetJqqKmSSkrV3pFZDE=; b=G0V/zmiOwh/DooCF9/ SOgYj0aMmuL5L1xb3gPe8Y8dTqdIVeXBeqz1mq6Jxg+osKNoYjwAtpnGDq87zeMj 0VlW/uJ47PEEZ9UBp1iHHNB7FnoIxGemWpPIWZzpTePMBm3S0LT/uk9YgbJtEQbI sXXXMqidNzsbiGlOKnqca/i0cHLlk0UXcEydW83v5qdK5GcIAR29dzmsfXcwoI3U xt4HXuSt3NbzDn4IN6gtDkDBxaB1by1f1kgl15NiHwEcgQtvCMlMi8YX2VEI8W2y P4IhzpytMehF8y97UIEcQeDf5tbhKWZdVCz5SSvSMj6UHCon80VgR/J8e8OnJF3Z 5Fww== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1683722047; x=1683808447; bh=s9i+8tJEWLPvY CzjqsdGvO5pKetJqqKmSSkrV3pFZDE=; b=fCIItgaxp1XpLfwPFbcLA7d6YKG5j Ea9Iuj4wpfngZ/NDJthHxJV2dxIp23zLVBUXp0DskuFxFpytwPkEnpCR1NU2wl1P C87dA+wAEKQA3HruQ6mhO7Dyzpr8daPAZ+KX3w2/N597AXThAbHpU6HajYN4mKZ0 K7sGqnDjA/sTyzdZ9mxgfzON9N3RTB/hINwPPKjxJIVMlYQFHwJrACAkME5fLIIm OSgZLCVayrsrbkDzTZ8TK3ra8urKCzu+ppyY0ArU421lXvqRmpAw5a2Du88cbVDF YEz8cFa8GqUG7kyTUVDXAzLUxEHUZYhoG80gMs3IC/id1SWUuDpoXqiKQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeegiedgfedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvdenucfhrhhomheprfgrthhr ihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvg hrnhepueektdevtdffveeljeetgfehheeigeekleduvdeffeeghefgledttdehjeelffet necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhsse hpkhhsrdhimh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 May 2023 08:34:06 -0400 (EDT) Received: by pks.im (OpenSMTPD) with ESMTPSA id dd42e52d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 10 May 2023 12:33:55 +0000 (UTC) Date: Wed, 10 May 2023 14:34:02 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Junio C Hamano , Felipe Contreras , Glen Choo , Jonathan Tan , Jacob Keller Subject: [PATCH v5 1/9] fetch: fix `--no-recurse-submodules` with multi-remote fetches Message-ID: <02ee4fab7e8b46bb04b1e7509bd752144ac77a12.1683721293.git.ps@pks.im> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When running `git fetch --no-recurse-submodules`, the exectation is that we don't fetch any submodules. And while this works for fetches of a single remote, it doesn't when fetching multiple remotes at once. The result is that we do recurse into submodules even though the user has explicitly asked us not to. This is because while we pass on `--recurse-submodules={yes,on-demand}` if specified by the user, we don't pass on `--no-recurse-submodules` to the subprocess spawned to perform the submodule fetch. Fix this by also forwarding this flag as expected. Signed-off-by: Patrick Steinhardt --- builtin/fetch.c | 2 ++ t/t5526-fetch-submodules.sh | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/builtin/fetch.c b/builtin/fetch.c index c310d89878..08d7fc7233 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1876,6 +1876,8 @@ static void add_options_to_argv(struct strvec *argv) strvec_push(argv, "--keep"); if (recurse_submodules == RECURSE_SUBMODULES_ON) strvec_push(argv, "--recurse-submodules"); + else if (recurse_submodules == RECURSE_SUBMODULES_OFF) + strvec_push(argv, "--no-recurse-submodules"); else if (recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND) strvec_push(argv, "--recurse-submodules=on-demand"); if (tags == TAGS_SET) diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh index dcdbe26a08..26e933f93a 100755 --- a/t/t5526-fetch-submodules.sh +++ b/t/t5526-fetch-submodules.sh @@ -1180,4 +1180,17 @@ test_expect_success 'fetch --all with --recurse-submodules with multiple' ' test_line_count = 2 fetch-subs ' +test_expect_success "fetch --all with --no-recurse-submodules only fetches superproject" ' + test_when_finished "rm -rf src_clone" && + + git clone --recurse-submodules src src_clone && + ( + cd src_clone && + git remote add secondary ../src && + git config submodule.recurse true && + git fetch --all --no-recurse-submodules 2>../fetch-log + ) && + ! grep "Fetching submodule" fetch-log +' + test_done