From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: Eric Sunshine <sunshine@sunshineco.com>, git@vger.kernel.org
Subject: Re: [RFC] usage_msg_opt() and _optf() must die
Date: Wed, 7 Aug 2024 07:01:56 +0200 [thread overview]
Message-ID: <ZrL_xI0bNga-RqCv@tanuki> (raw)
In-Reply-To: <xmqqikwds8pz.fsf@gitster.g>
[-- Attachment #1: Type: text/plain, Size: 2169 bytes --]
On Tue, Aug 06, 2024 at 01:21:44PM -0700, Junio C Hamano wrote:
> Eric Sunshine <sunshine@sunshineco.com> writes:
>
> >> I am very much tempted to suggest us do this.
> >>
> >> void NORETURN usage_msg_opt(const char *msg,
> >> - const char * const *usagestr,
> >> - const struct option *options)
> >> + const char * const *usagestr UNUSED,
> >> + const struct option *options UNUSED)
> >> {
> >> - die_message("%s\n", msg); /* The extra \n is intentional */
> >> - usage_with_options(usagestr, options);
> >> + die("%s", msg);
> >> }
> >
> > As a minimal "fix" to eliminate the user-hostile behavior, I would be
> > very much in favor of this change.
> >
> > (Retiring `usage_msg_opt` altogether would be even better, but is much
> > more invasive.)
>
> The above is following the usual "we make changes but be nice to in
> flight topics by keeping the API function still available, but the
> function now behaves better" pattern. In other words, elimination
> of the API function is a breaking change and can go slower. What
> needs more urgent to get to that goal would be to adjust the tests
> and documentation pages to the fallout from the above single liner.
I think it is fine to do the above as an intermediate step towards
dropping `usage_msg_opt()` altogether during this cycle. But what I'd
like to see is that we already convert all existing callers to stop
calling the function such that we can rest assured that we really can
drop the function once the Git v2.48 release cycle starts. Somewhat like
we have handled the deprecation of `struct ref_store`-less functions in
"refs.h".
Otherwise I fear that it's going to stay around indefinitely in a
misleading way.
I'm less sold on swapping the "usage:" prefix out for "error:". I think
that the "usage:" prefix actually gives a helpful signal to the user,
namely that it was the user that passed unexpected arguments. This is in
contrast to "error:", where the command went with what they gave it but
ultimately ended up running into an error condition.
Patrick
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2024-08-07 5:02 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-06 0:35 [PATCH v1 0/4] make "too many arguments" a bit more useful Junio C Hamano
2024-08-06 0:35 ` [PATCH v1 1/4] refs: avoid "too many arguments" Junio C Hamano
2024-08-06 6:13 ` Patrick Steinhardt
2024-08-06 16:48 ` Junio C Hamano
2024-08-06 17:11 ` [RFC] usage_msg_opt() and _optf() must die Junio C Hamano
2024-08-06 17:38 ` Eric Sunshine
2024-08-06 20:21 ` Junio C Hamano
2024-08-07 5:01 ` Patrick Steinhardt [this message]
2024-08-06 19:09 ` Justin Tobler
2024-08-06 19:24 ` Martin Ågren
2024-08-06 17:47 ` [PATCH v2] refs: avoid "too many arguments" Junio C Hamano
2024-08-06 0:35 ` [PATCH v1 2/4] cat-file: " Junio C Hamano
2024-08-06 0:35 ` [PATCH v1 3/4] notes: " Junio C Hamano
2024-08-06 0:35 ` [PATCH v1 4/4] miscellaneous: " Junio C Hamano
2024-08-06 2:31 ` Eric Sunshine
2024-08-06 16:50 ` 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=ZrL_xI0bNga-RqCv@tanuki \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=sunshine@sunshineco.com \
/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