From patchwork Fri May 10 11:25:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13661379 Received: from wfout8-smtp.messagingengine.com (wfout8-smtp.messagingengine.com [64.147.123.151]) (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 D19BB171655 for ; Fri, 10 May 2024 11:25:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.151 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715340333; cv=none; b=Xf6SaRCluEef1y44zmgUd0DLmlBT6gCgbscsfacNCuDYB9tw30b+MIV605/WbG3+4a22/5mPkwDpANvz0LrHSo7WRCrL+iUQnr90H/n5CrngquSJPXwMTauXOJ6XGvgALTCtXvaNBsDNwOZKNNQ8xSDaSwXn5iXhWucxULhQ7o0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715340333; c=relaxed/simple; bh=A7am5XZEJO/9I+CFBgqo866EJYKJsAl9YZ7vEKWWW2c=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=X6LHyazH8bfzL45IMNDrcVuYMD6fVIk+7Wjmlu2gys8jvhMEY/YpzkXN0JbvtP+GsQJUNp5UZiLgbJU6XcVGd9293wDApZe+ybC4xuirUnZGewOEXsqA5ZNaLDv9U6c48gxtY+437ljDtZbM+5hJLUQSb2WPw2kA6VkAgqLa51Q= 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=P/M0tB9b; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=P+acLU7D; arc=none smtp.client-ip=64.147.123.151 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="P/M0tB9b"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="P+acLU7D" Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfout.west.internal (Postfix) with ESMTP id 0F2341C00098 for ; Fri, 10 May 2024 07:25:30 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 10 May 2024 07:25:31 -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:subject :subject:to:to; s=fm3; t=1715340330; x=1715426730; bh=8AtDzK+N8E 07RuFjO9WAk2d7HQpaHl9r4Mpd/noT9Ro=; b=P/M0tB9bfzmgWW3Qr/zlf/KIxS NjreE+g9EuVU8CvO7HZg8yjZnIAUSQkGECtvv5caxLz+U0d2cw8iEA1s+mXhL/sc zsXMS2CZE6/QbCSReZdyqnQ8dmXsYkN3ijRzWFrvAP9d3OD/VZTKVEPRNVOD1a7R qvnLQsDts+97YHG5d1tuA3sAtPST4CarU+s+btdCYBK2wX8cvew1LhffDtBBGspH 5kwXWqFlqKFyVBLn232+t6ni37j26BYjGkCj7+78JV2ha2OI/iCuXNlYKzdKkJkV OWv1PeqCkLGqmx88pHVAATF+WPTo8OPbWzr/wginPcH1xFrVe1z8Vf7kYSig== 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:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1715340330; x=1715426730; bh=8AtDzK+N8E07RuFjO9WAk2d7HQpa Hl9r4Mpd/noT9Ro=; b=P+acLU7DomXVeY6bxGSNodOAfT25yWvW4VHPWSJxa5ga JaWx4zyjXameq7qNZ6euntNHTdpPIdU1HWz3FSpUz0y3YjkKxDd4SRfiw5kyRgNb Bk/Yu/BzFSu3nymGEjWyKy8jPQ0AE1BB2q+wWlRRxtgBQSsh3NwgcuRC9E9SstZr KcR2IvisK7ytOS7QB8EnxUoqR3ixHTdq80KRjpAmp4+NaodF8x8Cbn/PQFC3xf4d Cenb9u695tufzagKnhqYtrAXRqbhcXHJbYPWxz1vNeavNCQI6naV1sLkyRGT/yEB 2AHvP2DrVOBbkE3GfptiAM4IYcKsywYUizkD3XSs6w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdefkedggedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkfhggtggujgesghdtre ertddtvdenucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehp khhsrdhimheqnecuggftrfgrthhtvghrnhepheeghfdtfeeuffehkefgffduleffjedthf dvjeektdfhhedvlefgtefgvdettdfhnecuvehluhhsthgvrhfuihiivgepvdenucfrrghr rghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 10 May 2024 07:25:29 -0400 (EDT) Received: by localhost (OpenSMTPD) with ESMTPSA id f47202da (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 10 May 2024 11:25:16 +0000 (UTC) Date: Fri, 10 May 2024 13:25:27 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Subject: [PATCH 13/21] builtin/config: move `respect_includes_opt` into location options Message-ID: 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 eca5179f5f..d11d0b4784 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -78,8 +78,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")), \ @@ -126,7 +129,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 @@ -774,10 +776,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(); @@ -806,7 +808,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(), }; @@ -848,7 +851,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(), @@ -1131,7 +1135,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;