From patchwork Mon May 6 08:55:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13655170 Received: from wfhigh5-smtp.messagingengine.com (wfhigh5-smtp.messagingengine.com [64.147.123.156]) (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 134891D547 for ; Mon, 6 May 2024 08:55:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.156 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714985762; cv=none; b=PIoqFFnVdc8upFkaKd/V8NDW34Y7G2mIr4iJZ07JDUbzr7U2UjAoPGn5++WS1cz+MVjJYoXY0nsYIKLV3YhQVch92vrMxSUGPPQGK6N1lyqUUqLNbAFg5oGegt6+B/LvuqU3ofqoKtWG21di2M1soRaV5pKiuisK5nLq6royOLs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714985762; c=relaxed/simple; bh=/7rmMpnxxJVZKn4aw+x65FWkAcqsJwNR/DQKUdxx5RI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ERFMLDB1dFga8Gns6gWZ6fjLxi/t6jkOyaT1Z6Z6k0M0jdeUrdHaKtvZrWAPEhZ68gVCpE+D0jK5n6PgoNEx7shSdMza5tMegI8Y1RVAH8vYZ1YTDdGGiCh0BBZrj0c8bnYmIt7T2U5uZHcUjHN68m3wot7rTSPrX6tAqY1/H18= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none 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=dlQoLb9V; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=M+2rj/wR; arc=none smtp.client-ip=64.147.123.156 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none 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="dlQoLb9V"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="M+2rj/wR" Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfhigh.west.internal (Postfix) with ESMTP id A6D7618000B6; Mon, 6 May 2024 04:55:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 06 May 2024 04:55:59 -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=1714985758; x=1715072158; bh=L/bQzLQWq8 +2yBosFtwCQf5nJCw8B0pTBXnA8okuj+8=; b=dlQoLb9VfbDS5XcqZm8apko6Yh iibfxZrHTos5SoilIQGa8EPXt8QwRyWIbRd8xz4RN4wXxSxTD4rdzKXAkGt3UK96 I2cz2uj6XtGq+l+FPUZfSFeMWCkkkrUgJsF3mNGzvMnc/LH0BccYz2+0+7BgBhtR Ky84CxGZOV40r9dtEtWVf0kHo+dIOf2sBgQA8hdeYEiN9tslt5gXlGptna55pCHo xIfhmM3TZpJlHckBMveGqPhpLsuLhlBXl9EsvaFTuLtoGrUp5NYQx4uKBLIs3Dkt PdKvIfvkTEuv8eUcdNm1X1cbNOEqX3kv0WX1rpqv7ncCLNBJn5HhF9sQXQmQ== 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=1714985758; x=1715072158; bh=L/bQzLQWq8+2yBosFtwCQf5nJCw8 B0pTBXnA8okuj+8=; b=M+2rj/wRFdQryd2kJLwyt5c4/+YoThUA9lNGHYFQc8lu JxqPD3yhAm+UK+lzkCVPmIcedz68DONlKgM5UWvTAAQoEKrwpTFU/GzHzvv7w1VG yiZyN9NoCj1Gimdq+VrH9y7MzcD1SjWx7cXJHXesYGvJKQm39zvjY3hnH0CdxiDW jgdhsmMuYcNRPDaLIDEiZ1TWZLNZeL0fDP7s8wlyz3OggmbaSGFKD4CkR10Ynr8E xdJCOMkA2jenI1wjSJapGYtEKgT3IrFkz3aeQGC1VmHEAIC1mh+8rX458h/W7FBb pKABo+1gUBuL/7llgNdqPBKirLPrmDtY6fJ5xVFT+Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddviedguddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvdenucfhrhhomheprfgrthhr ihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvg hrnhepueektdevtdffveeljeetgfehheeigeekleduvdeffeeghefgledttdehjeelffet necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhsse hpkhhsrdhimh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 6 May 2024 04:55:56 -0400 (EDT) Received: by localhost (OpenSMTPD) with ESMTPSA id 8fcceb0d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 6 May 2024 08:55:48 +0000 (UTC) Date: Mon, 6 May 2024 10:55:51 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Kristoffer Haugsbakk , Taylor Blau , =?iso-8859-1?q?Jean-No=EBl?= AVILA , Eric Sunshine , Junio C Hamano , Dragan Simic , rsbecker@nexbridge.com Subject: [PATCH v5 00/14] builtin/config: introduce subcommands 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: Hi, this is the fifth and hopefully last version of my patch sthat introduces subcommands into git-config(1). The only changes compared to v4 are some fixes to commit messages. Otherwise I'm not aware of any other feedback that would need to be addressed. Patrick Patrick Steinhardt (14): config: clarify memory ownership when preparing comment strings builtin/config: move option array around builtin/config: move "fixed-value" option to correct group builtin/config: use `OPT_CMDMODE()` to specify modes builtin/config: pull out function to handle config location builtin/config: pull out function to handle `--null` builtin/config: introduce "list" subcommand builtin/config: introduce "get" subcommand builtin/config: introduce "set" subcommand builtin/config: introduce "unset" subcommand builtin/config: introduce "rename-section" subcommand builtin/config: introduce "remove-section" subcommand builtin/config: introduce "edit" subcommand builtin/config: display subcommand help Documentation/git-config.txt | 219 ++++++++------- builtin/config.c | 512 ++++++++++++++++++++++++++++------- config.c | 16 +- config.h | 2 +- t/t0450/txt-help-mismatches | 1 - t/t1300-config.sh | 432 +++++++++++++++++------------ 6 files changed, 812 insertions(+), 370 deletions(-) Range-diff against v4: 1: 3aa26d5bff ! 1: 881d2b5426 config: clarify memory ownership when preparing comment strings @@ Commit message not like this micro-optimization really matters. Thus, callers are now always responsible for freeing the value. + Signed-off-by: Patrick Steinhardt + ## builtin/config.c ## @@ builtin/config.c: static struct config_options config_options; static int show_origin; 2: 8f0804ab48 = 2: 66dffaa8f2 builtin/config: move option array around 3: ddcd8031d7 ! 3: 36abda0e02 builtin/config: move "fixed-value" option to correct group @@ Commit message builtin/config: move "fixed-value" option to correct group The `--fixed-value` option can be used to alter how the value-pattern - parameter is interpreted for the various submodes of git-config(1). But - while it is an option, it is currently listed as part of the submodes - group the command, which is wrong. + parameter is interpreted for the various actions of git-config(1). But + while it is an option, it is currently listed as part of the actions + group, which is wrong. Move the option to the "Other" group, which hosts the various options known to git-config(1). 4: 1bc3918840 = 4: 34b66f9c87 builtin/config: use `OPT_CMDMODE()` to specify modes 5: 3754812309 = 5: 4f90f206e7 builtin/config: pull out function to handle config location 6: cb1714c493 = 6: df1a6f14e6 builtin/config: pull out function to handle `--null` 7: b3f3c3ba6a ! 7: 1df76a9970 builtin/config: introduce "list" subcommand @@ Commit message builtin/config: introduce "list" subcommand While git-config(1) has several modes, those modes are not exposed with - subcommands but instead by specifying e.g. `--unset` or `--list`. This - user interface is not really in line with how our more modern commands - work, where it is a lot more customary to say e.g. `git remote list`. - Furthermore, to add to the confusion, git-config(1) also allows the user - to request modes implicitly by just specifying the correct number of - arguments. Thus, `git config foo.bar` will retrieve the value of - "foo.bar" while `git config foo.bar baz` will set it to "baz". + subcommands but instead by specifying action flags like `--unset` or + `--list`. This user interface is not really in line with how our more + modern commands work, where it is a lot more customary to say e.g. `git + remote list`. Furthermore, to add to the confusion, git-config(1) also + allows the user to request modes implicitly by just specifying the + correct number of arguments. Thus, `git config foo.bar` will retrieve + the value of "foo.bar" while `git config foo.bar baz` will set it to + "baz". Overall, this makes for a confusing interface that could really use a makeover. It hurts discoverability of what you can do with git-config(1) 8: 0e6da909ac = 8: 29676b81e0 builtin/config: introduce "get" subcommand 9: 8a623a31b9 = 9: 94afb5a5b7 builtin/config: introduce "set" subcommand 10: e25e5b69cd = 10: e525c2326a builtin/config: introduce "unset" subcommand 11: f24008d356 = 11: a797889890 builtin/config: introduce "rename-section" subcommand 12: fc2ddd3201 = 12: 8ec214755e builtin/config: introduce "remove-section" subcommand 13: 4c2d817eff = 13: 1893c23afc builtin/config: introduce "edit" subcommand 14: 4c351b12b8 = 14: 97a48ab81d builtin/config: display subcommand help base-commit: d4cc1ec35f3bcce816b69986ca41943f6ce21377