From patchwork Wed May 15 06:42:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13664680 Received: from fhigh2-smtp.messagingengine.com (fhigh2-smtp.messagingengine.com [103.168.172.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B6E13EA95 for ; Wed, 15 May 2024 06:42:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715755360; cv=none; b=J9X8EXIaakn/bOHNbQ2UZDRyN/pOqjc1s5s0ow89014yRQ6+kpQMctPBNeL3td0uYD3BBPGzkIYaQkVhsjTrSvAq1Q1qUbE+JTd0RjtJKiJLzpstw+d0p0a0W5myVdAP/ZRgAdjCzMkzo3J6dsB6wrv3RDQqpulKglPfOZuzXNY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715755360; c=relaxed/simple; bh=Fef3VV9Xl6ZgF0Aj/2ts5PacsjR2n+9nLxKmawVd5Do=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FDQNL5n1b3j0yvz+o0JgT/+jNqi/Tg+lLSpE2dFTalRwVOhH+a8QvLA9TbGVwXF3QTsdR0z5BjLY/hgreiTy6U8B/PSG/3MoyME6R/qUgOWe9aunyZSiFzmAac5D596Rp/NtY1p04N6tXKHqs2tTjLo7Eth7DNmvN6U7gCL17Hg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=rfAdCwwB; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=P2HgvY5p; arc=none smtp.client-ip=103.168.172.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="rfAdCwwB"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="P2HgvY5p" Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 9D3F611400AB; Wed, 15 May 2024 02:42:38 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 15 May 2024 02:42:38 -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:subject :subject:to:to; s=fm3; t=1715755358; x=1715841758; bh=tjf0GGkobq slKo9f90P1O9wJtLv2o7WYdiGgAOSPR2o=; b=rfAdCwwBJUBZ+G7mSR10VYLiDm 6RxSp54TWDq3gvKhLL5O1i10HTVfjvieNPSpWEfUVYosAuIqfuj5r/oNStyoQbu6 9iOjz6NsKg6Y68JpnXoNHfMzvoB0jqRoZK9fv6C9f/vqfCgUs7vs3JgAQlydMmKw N4ZXMDo+NQFUNqZoJ+Sn0stTfk88vFIZ2HOquJ5E1MLD/9fQ1ezWlq0H8ga80TlO I8I6/lm5U77UfxBHX0Mo0AW+IdXcPqFdeeFzijXoc5/sS0ddrm+aeKzqSJGsukj+ 2QVbHZm2bg+FqKTwwzVPuYBFrG3m/EHfg2HEgPPtP82L+okvHX3AhqXa7EhA== 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:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1715755358; x=1715841758; bh=tjf0GGkobqslKo9f90P1O9wJtLv2 o7WYdiGgAOSPR2o=; b=P2HgvY5pK9Bxw2Dj/PBnVhIzEHUDb+A9frRWphkVEjhH /9+7Q1UWDD/zyg+mVCF/pXBfTfy5zrl5xU034tHGinWCklvvuMkj/fgyBNPfMTwP i5kFU9wsv36SypKZ7ugI2lRtRUI7Knee6M/Qro2KMAWv5EWPlNt+vXiKwXQrQLEt JTeEnCgIBOFu+Cch6kIOcFimMGkhyktadbAFz2eE83xywL3Io/Ix6ptuptgTrtBj ALqzTtHe42A2GBpkuqvzZT7LCfqp7PPweZTZ/Behz3fP+G9ZwrIirkT0Ms1eHNt4 REsHHWglAy0kKgBwGwlv9UlmRaaf2FHtLk0SvcNHXQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdegjedguddtiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefrrght rhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtth gvrhhnpeeukedtvedtffevleejtefgheehieegkeeluddvfeefgeehgfeltddtheejleff teenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehpsh esphhkshdrihhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 15 May 2024 02:42:37 -0400 (EDT) Received: by localhost (OpenSMTPD) with ESMTPSA id 1be3ff23 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 15 May 2024 06:42:14 +0000 (UTC) Date: Wed, 15 May 2024 08:42:35 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Junio C Hamano , Kyle Lippincott , Eric Sunshine Subject: [PATCH v3 13/21] builtin/config: move `respect_includes_opt` into location options Message-ID: <15d45ef7d42d49623577f9b856e3f791c9a65948.1715755055.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: The variable tracking whether or not we want to honor includes is tracked via a global variable. Move it into the location options instead. Signed-off-by: Patrick Steinhardt --- builtin/config.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/builtin/config.c b/builtin/config.c index 8a327e770d..c54bdcbcdb 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -79,8 +79,11 @@ struct config_location_options { int use_system_config; int use_local_config; int use_worktree_config; + int respect_includes_opt; }; -#define CONFIG_LOCATION_OPTIONS_INIT {0} +#define CONFIG_LOCATION_OPTIONS_INIT { \ + .respect_includes_opt = -1, \ +} #define CONFIG_TYPE_OPTIONS(type) \ OPT_GROUP(N_("Type")), \ @@ -127,7 +130,6 @@ static regex_t *regexp; static int use_key_regexp; static int do_all; static int do_not_match; -static int respect_includes_opt = -1; static int fixed_value; #define TYPE_BOOL 1 @@ -776,10 +778,10 @@ static void location_options_init(struct config_location_options *opts, opts->source.scope = CONFIG_SCOPE_COMMAND; } - if (respect_includes_opt == -1) + if (opts->respect_includes_opt == -1) opts->options.respect_includes = !opts->source.file; else - opts->options.respect_includes = respect_includes_opt; + opts->options.respect_includes = opts->respect_includes_opt; if (startup_info->have_repository) { opts->options.commondir = get_git_common_dir(); opts->options.git_dir = get_git_dir(); @@ -808,7 +810,8 @@ static int cmd_config_list(int argc, const char **argv, const char *prefix) CONFIG_LOCATION_OPTIONS(location_opts), CONFIG_DISPLAY_OPTIONS(display_opts), OPT_GROUP(N_("Other")), - OPT_BOOL(0, "includes", &respect_includes_opt, N_("respect include directives on lookup")), + OPT_BOOL(0, "includes", &location_opts.respect_includes_opt, + N_("respect include directives on lookup")), OPT_END(), }; @@ -850,7 +853,8 @@ static int cmd_config_get(int argc, const char **argv, const char *prefix) OPT_STRING(0, "url", &url, N_("URL"), N_("show config matching the given URL")), CONFIG_DISPLAY_OPTIONS(display_opts), OPT_GROUP(N_("Other")), - OPT_BOOL(0, "includes", &respect_includes_opt, N_("respect include directives on lookup")), + OPT_BOOL(0, "includes", &location_opts.respect_includes_opt, + N_("respect include directives on lookup")), OPT_STRING(0, "default", &display_opts.default_value, N_("value"), N_("use default value when missing entry")), OPT_END(), @@ -1133,7 +1137,8 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix) N_("value"), N_("with --get, use default value when missing entry")), OPT_STRING(0, "comment", &comment_arg, N_("value"), N_("human-readable comment string (# will be prepended as needed)")), OPT_BOOL(0, "fixed-value", &fixed_value, N_("use string equality when comparing values to 'value-pattern'")), - OPT_BOOL(0, "includes", &respect_includes_opt, N_("respect include directives on lookup")), + OPT_BOOL(0, "includes", &location_opts.respect_includes_opt, + N_("respect include directives on lookup")), OPT_END(), }; char *value = NULL, *comment = NULL;