git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "D. Ben Knoble" <ben.knoble+github@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org,
	Lessley Dennington <lessleydennington@gmail.com>,
	 Jeff King <peff@peff.net>,
	Ayush Chandekar <ayu.chandekar@gmail.com>,
	 Elijah Newren <newren@gmail.com>,
	Usman Akinyemi <usmanakinyemi202@gmail.com>
Subject: Re: [PATCH 3/4] builtin: also setup gently for --help-all
Date: Wed, 30 Jul 2025 18:00:35 -0400	[thread overview]
Message-ID: <CALnO6CB+Hh46A=hLLNDYc2dJB=DbfdbethuGk0rzX3dA2ptO8g@mail.gmail.com> (raw)
In-Reply-To: <xmqqcy9kxrbw.fsf@gitster.g>

On Mon, Jul 28, 2025 at 11:33 AM Junio C Hamano <gitster@pobox.com> wrote:
>
> "D. Ben Knoble" <ben.knoble+github@gmail.com> writes:
>
> >     I originally considered leaving out the changes to
> >     show_usage_with_options_if_asked and relying on the parse-options API to
> >     do the right thing. Unfortunately, most commands can't make it all the
> >     way to parse-options when setting up gently, and trying to parse options
> >     without a repo creates myriad dependency problems (like: we might read
> >     config after parsing CLI options, so we have to make sure the parsed
> >     options overrride config).
> >
> >     Some usage.c callers, like check-ref-format, probably deserve to be
> >     ported to parse-options at this point.
>
> It is unclear what you mean by all of the above, but hopefully it
> would become clear as we read the code changes.
>
> [snip]
>
> I don't understand your "I originally considered leaving out ..." at
> all.  We are special casing a lone "-h" here already because we know
> this is where we should stop without exercising unnecessary code
> because we may not even have repo!=NULL and that is the reason why
> this function exists in the first place.  It is obvious to me that
> we need the same special casing for "--help-all".
>
> In other words, I think all the above changes are good.
>
> Thanks.

I'm glad it was obvious to you! I spent a lot of time trying to get
commands to call parse_options early, before touching any repository
variables, since that was the only place where I knew "--help-all" was
handled. This turned out to be a terrible mess, so I looked around for
a different path forward (the one here now), and that turned out to
work much better.

In that old world, parse-options doesn't change and the builtins need
a lot of surgery (and probably still aren't completely right)—I can
see how that note is confusing without that context, though, and I'll
drop it in future rounds (esp. now we've discussed this version).

  reply	other threads:[~2025-07-30 22:00 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-26 16:53 [PATCH 0/4] permit -h/--help-all in more scenarios D. Ben Knoble
2025-07-26 16:53 ` [PATCH 1/4] t1517: fixup for ua/t1517-short-help-tests D. Ben Knoble
2025-07-26 21:57   ` Usman Akinyemi
2025-07-28 15:35     ` Junio C Hamano
2025-07-26 16:53 ` [PATCH 2/4] parse-options: name flags passed to usage_with_options_internal D. Ben Knoble
2025-07-28 15:26   ` Junio C Hamano
2025-07-28 18:19     ` Junio C Hamano
2025-07-30 22:05     ` D. Ben Knoble
2025-07-26 16:53 ` [PATCH 3/4] builtin: also setup gently for --help-all D. Ben Knoble
2025-07-28 15:33   ` Junio C Hamano
2025-07-30 22:00     ` D. Ben Knoble [this message]
2025-07-26 16:53 ` [PATCH 4/4] builtins: show help on "-h"/"--help-all" with more than 2 arguments left D. Ben Knoble
2025-07-27  0:28   ` Junio C Hamano
2025-07-30 21:55     ` D. Ben Knoble
2025-08-02  9:23       ` Jeff King
2025-08-02 16:10         ` D. Ben Knoble
2025-08-02 16:28           ` Jeff King
2025-08-02 17:05             ` D. Ben Knoble
2025-08-03  1:26 ` [PATCH v2 0/3] permit -h/--help-all in more scenarios D. Ben Knoble
2025-08-03 16:10   ` [PATCH v3 " D. Ben Knoble
2025-08-04  4:53     ` Junio C Hamano
2025-08-05  1:28       ` D. Ben Knoble
2025-08-03 16:10   ` [PATCH v3 1/3] t1517: fixup for ua/t1517-short-help-tests D. Ben Knoble
2025-08-03 16:41     ` Junio C Hamano
2025-08-03 16:43       ` D. Ben Knoble
2025-08-03 16:10   ` [PATCH v3 2/3] parse-options: refactor flags for usage_with_options_internal D. Ben Knoble
2025-08-03 16:10   ` [PATCH v3 3/3] builtin: also setup gently for --help-all D. Ben Knoble
2025-08-03  1:26 ` [PATCH v2 1/3] t1517: fixup for ua/t1517-short-help-tests D. Ben Knoble
2025-08-03  1:26 ` [PATCH v2 2/3] parse-options: refactor flags for usage_with_options_internal D. Ben Knoble
2025-08-03  1:26 ` [PATCH v2 3/3] builtin: also setup gently for --help-all D. Ben Knoble

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='CALnO6CB+Hh46A=hLLNDYc2dJB=DbfdbethuGk0rzX3dA2ptO8g@mail.gmail.com' \
    --to=ben.knoble+github@gmail.com \
    --cc=ayu.chandekar@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=lessleydennington@gmail.com \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    --cc=usmanakinyemi202@gmail.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;
as well as URLs for NNTP newsgroup(s).