From patchwork Wed May 17 11:49:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13244777 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 2EF25C77B75 for ; Wed, 17 May 2023 11:49:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230027AbjEQLti (ORCPT ); Wed, 17 May 2023 07:49:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230296AbjEQLtV (ORCPT ); Wed, 17 May 2023 07:49:21 -0400 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FE7159DA for ; Wed, 17 May 2023 04:49:20 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 1C1F032008C3 for ; Wed, 17 May 2023 07:49:20 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 17 May 2023 07:49:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=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=fm1; t=1684324159; x=1684410559; bh=64 wpYUiW4jS/CcCCMLrzOd2XSkgM0m9UnFKQwP/r1pc=; b=k67yWIfJZZZ94diRj1 rBqqMEQ0wywueUNV9Dp+qM51PUY3Q1tR+tu6B8B96Fzl52SHN14l6hDB0DY1fTLz HMq3UizZ2VJQkL9Qk1OazcJJS06v/mcsLMb3vk0PjX2J3HG91K0tynOm+/7w8bAL 4PPENBTTpqRPbXHNUhnZUa1/PSECv4GPYRFraBZTrVVO/czdG9K0wpQG3Aaps3EH uTlrZYunRzJOsaDOw0mM7/E9xbfytu4cbPcEG8Esejxh+WkDgZ27lBemPEjs8x8z TD1e1+xNvG63KC4j26EspbdchBEBZXUhZnnt0DTgwh3ilqPACoX9m6OVG/kWtCuv j9cA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=fm1; t=1684324159; x=1684410559; bh=64wpYUiW4jS/C cCCMLrzOd2XSkgM0m9UnFKQwP/r1pc=; b=BGD3leJgzljO7zUmFyTs7ZuSLkEeJ Tg/yxLBu2QAIM5ww/EyUDGF0fFs47VLj7ILPfb3g4YfjFftqS77cI7CXV8hP6+un By0q51pui86qAysz9QdWk76yMasm5iNrddyGodJKPFCb0mO68k1EXLW7Np0ZJM8s 0dJqNJFvtBywp70Qgd/5Ra9h4InLd0XIj7oZUzZlrTBcgtKspezXYR0CpVTHOEhb k58zz4dwTc9lQ5QfCexVB3PHWXJtKIXs8mA3vYgmbjpJ/KUahZsdpttvYzr5FfqS 223m95t6FMDswv9TaxI70YJrpPF8E6vR0UyDcJrry77Yqo31HhKD0CStg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeiuddggeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkfhggtggujgesghdtre ertddtvdenucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehp khhsrdhimheqnecuggftrfgrthhtvghrnhepheeghfdtfeeuffehkefgffduleffjedthf dvjeektdfhhedvlefgtefgvdettdfhnecuvehluhhsthgvrhfuihiivgepvdenucfrrghr rghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 17 May 2023 07:49:18 -0400 (EDT) Received: by pks.im (OpenSMTPD) with ESMTPSA id 8c8e0dc7 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Wed, 17 May 2023 11:48:55 +0000 (UTC) Date: Wed, 17 May 2023 13:49:17 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Subject: [PATCH 9/9] fetch: use `fetch_config` to store "submodule.fetchJobs" value Message-ID: <0eb84712a07243957d8037d7f1b3ad01260abe2f.1684324059.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 Move the parsed "submodule.fetchJobs" config value into the `fetch_config` structure. This reduces our reliance on global variables and further unifies the way we parse the configuration in git-fetch(1). Signed-off-by: Patrick Steinhardt --- builtin/fetch.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/builtin/fetch.c b/builtin/fetch.c index 29b36da18a..e3871048cf 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -86,7 +86,6 @@ static int write_fetch_head = 1; static int verbosity, deepen_relative, set_upstream, refetch; static int progress = -1; static int tags = TAGS_DEFAULT, update_shallow, deepen; -static int submodule_fetch_jobs_config = -1; static int atomic_fetch; static enum transport_family family; static const char *depth; @@ -108,6 +107,7 @@ struct fetch_config { int show_forced_updates; int recurse_submodules; int parallel; + int submodule_fetch_jobs; }; static int git_fetch_config(const char *k, const char *v, void *cb) @@ -136,7 +136,7 @@ static int git_fetch_config(const char *k, const char *v, void *cb) } if (!strcmp(k, "submodule.fetchjobs")) { - submodule_fetch_jobs_config = parse_submodule_fetchjobs(k, v); + fetch_config->submodule_fetch_jobs = parse_submodule_fetchjobs(k, v); return 0; } else if (!strcmp(k, "fetch.recursesubmodules")) { fetch_config->recurse_submodules = parse_fetch_recurse_submodules_arg(k, v); @@ -2119,6 +2119,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) .show_forced_updates = 1, .recurse_submodules = RECURSE_SUBMODULES_DEFAULT, .parallel = 1, + .submodule_fetch_jobs = -1, }; const char *submodule_prefix = ""; const char *bundle_uri; @@ -2268,8 +2269,8 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) } if (config.recurse_submodules != RECURSE_SUBMODULES_OFF) { - int *sfjc = submodule_fetch_jobs_config == -1 - ? &submodule_fetch_jobs_config : NULL; + int *sfjc = config.submodule_fetch_jobs == -1 + ? &config.submodule_fetch_jobs : NULL; int *rs = config.recurse_submodules == RECURSE_SUBMODULES_DEFAULT ? &config.recurse_submodules : NULL; @@ -2432,7 +2433,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) int max_children = max_jobs; if (max_children < 0) - max_children = submodule_fetch_jobs_config; + max_children = config.submodule_fetch_jobs; if (max_children < 0) max_children = config.parallel;