Subject: Re: [PATCH v2] repo: show subcommand-specific help text

From: Patrick Steinhardt <[email-masked]>
Date: Tue, 24 Mar 2026 13:52:37 +0100

On Tue, Mar 24, 2026 at 01:21:11PM +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.
> 
> ---
> v2:
> - wrap commit message lines
> - factor shared usage strings into macros to avoid duplication
> - restore blank lines between tests and before test_done

Something most have gone wrong, as I cannot see any of the macros. We
still duplicate the usage strings.

Patrick

> diff --git a/builtin/repo.c b/builtin/repo.c
> index 55f9b9095c..5ccc5c401a 100644
> --- a/builtin/repo.c
> +++ b/builtin/repo.c
> @@ -27,6 +27,17 @@ static const char *const repo_usage[] = {
>  	NULL
>  };
>  
> +static const char *const repo_info_usage[] = {
> +	"git repo info [--format=(lines|nul) | -z] [--all | <key>...]",
> +	"git repo info --keys [--format=(lines|nul) | -z]",
> +	NULL
> +};
> +
> +static const char *const repo_structure_usage[] = {
> +	"git repo structure [--format=(table|lines|nul) | -z]",
> +	NULL
> +};
> +
>  typedef int get_value_fn(struct repository *repo, struct strbuf *buf);
>  
>  enum output_format {