🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #4210

Re: [PATCH 3/5] builtin/multi-pack-index: drop top-level options

#4210
From: Justin Tobler
Date: Tue, 01 Dec 2026 17:11
68 lines
13201 bytes
On 26/12/01 11:58AM, Patrick Steinhardt wrote:
> On Mon, Nov 30, 2026 at 03:54:59PM -0600, Justin Tobler wrote:
> > diff --git a/Documentation/git-multi-pack-index.adoc b/Documentation/git-multi-pack-index.adoc
> > index c6d23aeeb9a0..0dd675f3fd46 100644
> > --- a/Documentation/git-multi-pack-index.adoc
> > +++ b/Documentation/git-multi-pack-index.adoc
> > @@ -9,16 +9,16 @@ git-multi-pack-index - Write and verify multi-pack-indexes
> >  SYNOPSIS
> >  --------
> >  [verse]
> > -'git multi-pack-index' [<options>] write [--preferred-pack=<pack>]
> > +'git multi-pack-index' write [<options>] [--preferred-pack=<pack>]
> 
> Is the `[<options>]` placeholder even required now? We already list all
> the options, don't we?

Both the synopsis and usage strings still only explicitly list the
options specific to each subcommand. The common options are only denoted
via `[<options>]`. It might just be better to be explicit here though
and write out both the common options for each of the subcommands. I'll
do this in the next version.

> > diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c
> > index 8528f4f513ef..2b4e2f0cce9e 100644
> > --- a/builtin/multi-pack-index.c
> > +++ b/builtin/multi-pack-index.c
> > @@ -415,7 +415,7 @@ int cmd_multi_pack_index(int argc,
> >  {
> >  	int res;
> >  	parse_opt_subcommand_fn *fn = NULL;
> > -	struct option builtin_multi_pack_index_options[] = {
> > +	struct option options[] = {
> >  		OPT_SUBCOMMAND("repack", &fn, cmd_multi_pack_index_repack),
> >  		OPT_SUBCOMMAND("write", &fn, cmd_multi_pack_index_write),
> >  		OPT_SUBCOMMAND("compact", &fn, cmd_multi_pack_index_compact),
> > @@ -423,7 +423,6 @@ int cmd_multi_pack_index(int argc,
> >  		OPT_SUBCOMMAND("expire", &fn, cmd_multi_pack_index_expire),
> >  		OPT_END(),
> >  	};
> > -	struct option *options = parse_options_concat(builtin_multi_pack_index_options, common_opts);
> >  
> >  	disable_replace_refs();
> >  
> > @@ -431,7 +430,6 @@ int cmd_multi_pack_index(int argc,
> >  
> >  	argc = parse_options(argc, argv, prefix, options,
> >  			     builtin_multi_pack_index_usage, 0);
> > -	FREE_AND_NULL(options);
> >  
> >  	res = fn(argc, argv, prefix, repo);
> >  
> 
> I really dislike this `parse_options_concat()` pattern. We can also
> easily replace it by defininging something like:
> 
>         #define MULTI_PACK_INDEX_COMMON_OPTIONS(var) \
>                 OPT_FOO(...), \
>                 OPT_BAR(...)
> 
> And then you simply add it to the options at compile time. So maybe
> that's another refactoring we could add in a subsequent patch?
> 
> ... Ah, you already do in your next patch. Great!

Yup! :)

-Justin
Technical Details
Message-ID: <aw76H8aiByt-UFZp@denethor>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76806-linux-kernel-git=dewy.ru
References: <cover.1796075503.git.jltobler@gmail.com> <cc2876d6803f4ac5d504ce18a5380949b97e65cf.1796075503.git.jltobler@gmail.com> <aw6oUL0h_zEMtCy8@pks.im>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76806-linux-kernel-git=dewy.ru
From: jltobler@gmail.com (Justin Tobler)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH 3/5] builtin/multi-pack-index: drop top-level options
Date: Tue, 1 Dec 2026 11:11:21 -0600
Organization: Usenet Network
Message-ID: <aw76H8aiByt-UFZp@denethor>
References: <cover.1796075503.git.jltobler@gmail.com>
 <cc2876d6803f4ac5d504ce18a5380949b97e65cf.1796075503.git.jltobler@gmail.com>
 <aw6oUL0h_zEMtCy8@pks.im>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="1774423"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:FFHX+CAFS2/x1/AplW1P7Vq9XRk= sha256:rsMUOCZ3AF2H3ISQ31R5OJcuv9VKDnB7RAWssJlzROw=
	sha1:ceBumT6VyzdohCiy9T2KlNEsd50= sha256:9jI+WhAoqDYXK2+6H7qIBLr0C7O1V6+Bm3uf2Qn/9Tw=
Content-Disposition: inline
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id F2D1C117428; Tue,  1 Dec 2026 20:11:51 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.949
X-Spam-Status: No, score=-1.949 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id LDbJy4ULOERe;
	Tue,  1 Dec 2026 20:11:49 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-76806-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id E1D54117425; Tue,  1 Dec 2026 20:11:40 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id D439825B87; Tue,  1 Dec 2026 17:11:27 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796145086;
	b=dXoL5IR+xbN0ZEgayr1cb1CKKV/CWTeAbEfuqrKZWtIx5h3vwpIFhWbmzfGuS7muHybf
	 zQAFzjauokEa20O4niVriR9DdDjezumZGiPefkCfAHdh1Ot4Llm44TKaHQlV6EsJWAWcf
	 Mmw2sj3DltejvL5trmhTvJ8hcuiJwEExhFQDdL2cWvXp+JHdMCFnI44C7555MsKu1f8qn
	 pFnXIzc22FSDtpRyxhqUX2QrBQQ3F897W3BQlO994/mAUjMEU/TJAgxiAgNx97xhvdoWn
	 eOYgvlrGfjAQfED/JNravsoN0PYv+M0wOQE7C+58oWWwjwKLbz2VGHBXZ5u1er9Wv+w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796145086;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:Date:From:To:Cc:Subject:Message-ID:References:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:Content-Type:Content-Disposition:
	 In-Reply-To;
	bh=iEer9lLWXceee9sfE75q4/tyVqsIo7ty8MdHvW+rGOE=;
	b=M+g0SmA5BDLmp6k4oecVH5fjkwKxAfbhna6lWREFkdLQoRzCb5vKgstghpTdaGHEHW0K
	 wbc3sllXcpcq17LJTW6klessv+qUAnxxCU94edhq+kG2vGY5YgQvbbV2E37ARY8vkP1J0
	 QAuLeoc6Jp3mdNXbsCF8kJnG5RNy1yiNMj2nSB4VP7Le8zGDhEwVBdSTGqRTav4S3MS9I
	 1vSqAsMCDb4quKasibq+Zc6/XB9D6k2oHGs80VWEZu5JrJrh18T5FOx7qSz5Nx+IzTLHr
	 iQcaiwKH4qQWF2fHnfjJP2VFuq9c1tXwh+GwRWKLltcLMh/HE2/v75cxDmaBCTHWKlA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=z3cCVFbe;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id C3DD5606A32C;
	Tue,  1 Dec 2026 17:11:26 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=z3cCVFbe
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.44
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796145086;
	b=psdeZ+cVPcpo0AxoH1sXPRw9o9CwJ8Uf7Y02wCv9NXy+fljpfkpuazRQooaA+9SIKDGT
	 gd2gGlNEp6epmYgk/J2jng0l+N/vCEDJwrU2avbU41mV6rY0HKESPIWty4qS5jDxTEImU
	 te6rUxy+1o9ZEbLZd99M5ML7B2SOnzhkV4xCsZvnFT3PJYvHAYlj9p+HZwjgUUHyFoNjL
	 g8DigcaoFvu/B5WoIzBlzc61ac0Ih+W7l4wADmDG+CWydfiPxjqioMZ/4LcpmW+4dw7G4
	 xJwoRvyl6fd4fU+bKVlFFPOd77w+1hPja+29BkKWxJ3CZlS8ZrETPj3UFtkcNbc8xjA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796145086;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Date:From:To:Cc:
	 Subject:Message-ID:References:MIME-Version:Content-Type:
	 Content-Disposition:In-Reply-To;
	bh=iEer9lLWXceee9sfE75q4/tyVqsIo7ty8MdHvW+rGOE=;
	b=UgYV0W4Q/gpVJ0ScgyzWd+JUKwZ51xWZl6KhBgMfoqU+gyAjSEWWXSeJeqpTvDldsFb7
	 fPNm84gzJ1V7fDhbJH9GUR0SwvY1Qr7EFrEYa52O+4I5XdWwgyJ+/m/sJc2wuaNnECazS
	 AK7U8SP+frJ/YtDQqTN456zHT5jpw/ab/LiEgHHMaNC/KqAwhnvtrUJcbqMdXjnHCIDzs
	 xox5CprxweXTmthrBJaYKUnPmyEhbDOA/5BepRRMUfK59noAR3PEs1r7VRuh2/3FTFIju
	 6Phujn5rBFpx2eKIIB6fqEEXDKfcOG+8bmiyIS67T0T1XBMxXE9xSiTSIGqXM33/c/g==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=z3cCVFbe;
	arc=none smtp.remote-ip=209.85.160.44
X-Received: from mail-oa1-f44.google.com (mail-oa1-f44.google.com [209.85.160.44])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91DBC606A31A
	for <git@vger.kernel.org>; Tue,  1 Dec 2026 17:11:25 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 91DBC606A31A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-499f20c7054so6249004fac.0
        for <git@vger.kernel.org>; Tue, 01 Dec 2026 09:11:25 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1796145084; x=1796749884; darn=vger.kernel.org;
        h=in-reply-to:content-disposition:content-type:mime-version
         :references:message-id:subject:cc:to:from:date:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=iEer9lLWXceee9sfE75q4/tyVqsIo7ty8MdHvW+rGOE=;
        b=z3cCVFbebq0DEUsq/YA2zx1uYV/5NWm4/ZRuHJIFAHYZsfSl4PoaiK9Hz9NtZZJmx6
         trOYveJicc8RYtQ5tPWJARhdjPqw5uyUwykzQRoSf37xz2Rf87FsFHIgU62uEC3RHrUl
         1QRvOsFlzustzXLUW3TGUqzPrBtq7mOj3bPnSCeZ3rYxfEHXDZIQKhDS2qR4oa0v5Vwn
         9Vlh/NEysymzEZimD1L+yOJ6/0FjyzcmnxmmX/DniDjPX4FiMAR4A7nqxvxFtnk7bYgv
         4QuBjc2pu0XwvmszQGP1gd8/P/WKXBQZJqqKlqhdI0J6D1tcCjAm7LVLX9IJbKIZOvA5
         9Rdw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796145084; x=1796749884;
        h=in-reply-to:content-disposition:content-type:mime-version
         :references:message-id:subject:cc:to:from:date:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=iEer9lLWXceee9sfE75q4/tyVqsIo7ty8MdHvW+rGOE=;
        b=nLOhUMSukNQ/hSLISVjyhUJtYlfdwJX4YSZvKHHUF+R45A48Vz2ghpV587i2j5wwu0
         u7s+MlZLd05swMPUGwDGrliBXQXHPpBLNSHGyfLNlGtSQUkpY4QKMbtz31L8vhd44vZ3
         1nzeD0n6f4PldJepEgPX3VnwZqznWnqJZlHP1obWt9RsdbJWBIZuI+oCjsWfT8byTZaL
         o+wM2pA1PNEECSuPLDZvQxEzLt9W3jQPBptWg/Vuei/4EHsn03AogMghN1QVe2EXb2F0
         icpvphbgjIPjaLvwWoaaHZnKNlyxmpYuJz38/3GgZzvBotTN5m+VQqAlR2qxsccOJlsd
         K19g==
X-Gm-Message-State: APuU4Z+Bm5lY5YESYOuVAbSFh5nU7/uKM4qTsd3ox8M2Van1+U2f45LB
	bxN31TnOPC0PVnMo3eKk9oHPKiaUDI+iQkiPtDCWN1xdb+5e20YEdPx/TicbYA==
X-Gm-Gg: AZFdTZdor9eH8cSHh76lYpT0DBxVmQWvy6LvcyQYqFQpK/CW9x+g2/y+LKZJf1HC72t
	nbuPqERsSA/WXHhydCuuLQ4Dx3ktdwFRbAdTFQNyWcEJTylVysNy0ZNdN4r+dsnj5BzkTdWw8Fo
	Pbndxt4XcbPDtkym8X/1MpAQs1m4Ckz2QWxmGnMH1lgIRQ/YAg1EDwjduBC4XJVKyZa2lX11mxd
	XiiPivbYmnms9c/fTybD696+sbiUglkACk/8JfEJ7i2XP+ouzM05MyoS+kGMxJ38SXxyEMJ2k4t
	1S1wXSE77W6zpp8S4dpaXIbWf+85P+AuhIiY/q08sutqqO+OPzTYQuw4GelWrGzA8S4ETEDeSle
	a8k8FccucfBf8xkGFN5tDU/d6p5tt/sW6/kxsKXNpZ3vLPvsoEi4/seEYeFFSWvmiAXNNbBWMXD
	2R01S3ha9QlUfhRU4D6agSFGyV4W0sZz5mAjehJHG4RLsCpfOl2I/9wCzpzheNMdmk3+eWGqI+R
	uKtfHveCIlyo+AUUK9eDrB6I5uGrTK6YCHBGb0chmGwAa+NO5lQ1XlBqxQE+1uqywWMjpbThZ4P
	LF4zjlGPYfmvCqcp6Vg3uLCe5T3lA3+zdd+lgXMGT7JxEwIkvpsv
X-Received: by 2002:a05:6870:7889:b0:494:116a:b0f1 with SMTP id 586e51a60fabf-4bc803ddcccmr35347635fac.21.1796145084456;
        Tue, 01 Dec 2026 09:11:24 -0800 (PST)
X-Received: from localhost ([136.51.44.64])
        by smtp.gmail.com with ESMTPSA id 586e51a60fabf-4bc5edc52aasm34781827fac.4.2026.12.01.09.11.23
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Tue, 01 Dec 2026 09:11:23 -0800 (PST)
X-Cc: git@vger.kernel.org
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <aw6oUL0h_zEMtCy8@pks.im>