From: Patrick Steinhardt <ps@pks.im>
To: Mahi Kassa <mahlet.takassa@gmail.com>
Cc: git@vger.kernel.org, gitster@pobox.com,
lucasseikioshiro@gmail.com, jltobler@gmail.com
Subject: Re: [PATCH v3] repo: show subcommand-specific help text
Date: Wed, 25 Mar 2026 11:01:31 +0100 [thread overview]
Message-ID: <acOye5MbsFVOa1vJ@pks.im> (raw)
In-Reply-To: <20260324184843.299223-1-mahlet.takassa@gmail.com>
On Tue, Mar 24, 2026 at 07:48:43PM +0100, Mahi Kassa wrote:
> Use subcommand-specific usage arrays for "git repo info" and
> "git repo structure" so that each command shows only its own
> synopsis in help output.
>
> Factor the shared usage strings into macros to avoid
> duplicating the same synopsis text in multiple arrays.
>
> Add tests to cover the subcommand help behavior.
>
> The previous reroll mistakenly omitted the requested code
> changes; this version includes them.
>
> ---
> v3:
> - include the requested code changes that were missing from v2
> - factor shared usage strings into macros to avoid duplication
> - restore blank lines between tests and before test_done
By the way, it is highly recommended to respond to some of the review
mails directly, as it helps to create a dialog between submitter and
reviewer. Otherwise reviewers may feel as if they are talking to a code
emitting entity :)
It's not necessary to reply to every single mail, but going like "Oops,
yes, I indeed forgot to add the request code changes. Will fix in the
next version" can go a long way to make the interaction more social.
> diff --git a/builtin/repo.c b/builtin/repo.c
> index 55f9b9095c..71a5c1c29c 100644
> --- a/builtin/repo.c
> +++ b/builtin/repo.c
> @@ -20,11 +20,27 @@
> #include "tree-walk.h"
> #include "utf8.h"
>
> +#define REPO_INFO_USAGE \
> + "git repo info [--format=(lines|nul) | -z] [--all | <key>...]", \
> + "git repo info --keys [--format=(lines|nul) | -z]"
> +
> +#define REPO_STRUCTURE_USAGE \
> + "git repo structure [--format=(table|lines|nul) | -z]"
> +
> static const char *const repo_usage[] = {
> - "git repo info [--format=(lines|nul) | -z] [--all | <key>...]",
> - "git repo info --keys [--format=(lines|nul) | -z]",
> - "git repo structure [--format=(table|lines|nul) | -z]",
> - NULL
> + REPO_INFO_USAGE,
> + REPO_STRUCTURE_USAGE,
> + NULL,
> +};
> +
> +static const char *const repo_info_usage[] = {
> + REPO_INFO_USAGE,
> + NULL,
> +};
> +
> +static const char *const repo_structure_usage[] = {
> + REPO_STRUCTURE_USAGE,
> + NULL,
> };
>
> typedef int get_value_fn(struct repository *repo, struct strbuf *buf);
I think it would make sense to split this out into two commits: one
where you introduce the macros as a preparatory refactoring, and then
the next one where you start to differentiate the different usage
strings.
Otherwise this looks good to me now, thanks!
Patrick
next prev parent reply other threads:[~2026-03-25 10:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 15:29 [PATCH] repo: show subcommand-specific help text Mahi Kassa
2026-03-23 19:32 ` Derrick Stolee
2026-03-24 6:26 ` Patrick Steinhardt
2026-03-24 12:21 ` [PATCH v2] " Mahi Kassa
2026-03-24 12:52 ` Patrick Steinhardt
2026-03-24 17:07 ` Derrick Stolee
2026-03-24 18:48 ` [PATCH v3] " Mahi Kassa
2026-03-24 19:15 ` Derrick Stolee
2026-03-25 10:01 ` Patrick Steinhardt [this message]
2026-03-25 16:55 ` 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=acOye5MbsFVOa1vJ@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jltobler@gmail.com \
--cc=lucasseikioshiro@gmail.com \
--cc=mahlet.takassa@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