From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [Bug] duplicated long-form options go unnoticed
Date: Thu, 26 Feb 2026 16:13:16 -0800 [thread overview]
Message-ID: <xmqq5x7jujqb.fsf@gitster.g> (raw)
If you make this stupid change to builtin/cat-file.c, rebuild your
git and run "git cat-file --batch-check", without anybody helping
you notice that your change to add a duplicated long command to the
options table is a nonsense. There should be some way to help the
developer.
The most expensive would be a run-time check in parse_options_check(),
which is not very advisable, but it may be OK to have one hidden behind
a conditional debugging option (like exporting GIT_PARSEOPT_PARFNOID
variable).
builtin/cat-file.c | 1 +
1 file changed, 1 insertion(+)
diff --git i/builtin/cat-file.c w/builtin/cat-file.c
index b6f12f41d6..eaa53b2b29 100644
--- i/builtin/cat-file.c
+++ w/builtin/cat-file.c
@@ -1091,6 +1091,7 @@ int cmd_cat_file(int argc,
N_("like --batch, but don't emit <contents>"),
PARSE_OPT_OPTARG | PARSE_OPT_NONEG,
batch_option_callback),
+ OPT_BOOL(0, "batch-check", &batch, N_("batch")),
OPT_BOOL_F('z', NULL, &input_nul_terminated, N_("stdin is NUL-terminated"),
PARSE_OPT_HIDDEN),
OPT_BOOL('Z', NULL, &nul_terminated, N_("stdin and stdout is NUL-terminated")),
next reply other threads:[~2026-02-27 0:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-27 0:13 Junio C Hamano [this message]
2026-02-27 19:27 ` [PATCH 1/2] pack-objects: remove duplicate --stdin-packs definition René Scharfe
2026-02-27 19:27 ` [PATCH 2/2] parseopt: check for duplicate long names and numerical options René Scharfe
2026-02-27 22:50 ` Jeff King
2026-02-27 23:08 ` Jeff King
2026-02-27 23:28 ` Junio C Hamano
2026-02-28 9:19 ` René Scharfe
2026-02-28 9:19 ` [PATCH v2 " René Scharfe
2026-02-28 10:58 ` Jeff King
2026-02-28 11:28 ` René Scharfe
2026-03-02 18:24 ` Jeff King
2026-03-01 14:33 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq5x7jujqb.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox