From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Andrei Rybak <rybak.a.v@gmail.com>,
git@vger.kernel.org,
Christian Couder <christian.couder@gmail.com>,
Felipe Contreras <felipe.contreras@gmail.com>
Subject: Re: [PATCH resend] help: convert git_cmd to page in one place
Date: Tue, 06 Jul 2021 13:11:05 -0700 [thread overview]
Message-ID: <xmqqfswri4o6.fsf@gitster.g> (raw)
In-Reply-To: <87tul9706u.fsf@evledraar.gmail.com> ("Ævar Arnfjörð Bjarmason"'s message of "Mon, 05 Jul 2021 08:15:25 +0200")
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>> @@ -606,16 +604,17 @@ int cmd_help(int argc, const char **argv, const char *prefix)
>>
>> argv[0] = check_git_cmd(argv[0]);
>>
>> + page = cmd_to_page(argv[0]);
>
> Nit not requring a re-roll: I'd snuggle this with the argv[0], not the
> switch statement, i.e. like the existing code.
Makes sense.
>> switch (help_format) {
>> case HELP_FORMAT_NONE:
>> case HELP_FORMAT_MAN:
>> - show_man_page(argv[0]);
>> + show_man_page(page);
>> break;
>> case HELP_FORMAT_INFO:
>> - show_info_page(argv[0]);
>> + show_info_page(page);
>> break;
>> case HELP_FORMAT_WEB:
>> - show_html_page(argv[0]);
>> + show_html_page(page);
>> break;
>> }
>
> More generally (not the fault of this patch) the control flow in that
> file is quite a mess. I wondered why we can't just add this to
> check_git_cmd() then, it's also only called in that one place.
>
> We can, but it and cmd_to_page() return in multiple places, and
> help_unknown_cmd() might return, might exit(1) itself etc, so fixing
> similar to my 338abb0f045 (builtins + test helpers: use return instead
> of exit() in cmd_*, 2021-06-08) should probably be part of some general
> refactoring... :)
True, too.
next prev parent reply other threads:[~2021-07-06 20:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-26 16:32 [PATCH] help: convert git_cmd to page in one place Andrei Rybak
2021-06-26 17:57 ` Felipe Contreras
2021-07-04 15:39 ` [PATCH resend] " Andrei Rybak
2021-07-05 6:15 ` Ævar Arnfjörð Bjarmason
2021-07-06 20:11 ` Junio C Hamano [this message]
2021-07-08 8:07 ` Andrei Rybak
2021-07-08 15:12 ` 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=xmqqfswri4o6.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=christian.couder@gmail.com \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=rybak.a.v@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.