git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4 1/2] repo: factor repo usage strings into shared macros

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 25, 2026, 17:35 UTC
Message-ID
<xmqqqzp7vmlm.fsf@gitster.g>
In-Reply-To
<20260325115148.101867-1-mahlet.takassa@gmail.com>
Mahi Kassa <mahlet.takassa@gmail.com> writes:
Show 14 quoted lines
> Factor the "git repo info" and "git repo structure" usage
> strings into shared macros so they can be reused in multiple
> usage arrays.
>
> This is a preparatory refactoring for subsequent changes to
> subcommand-specific help output.
>
> Signed-off-by: Mahi Kassa <mahlet.takassa@gmail.com>
>
> ---
> v4:
> - split the preparatory macro refactoring into its own patch
>  builtin/repo.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
Looking good.  The distribution of commas are sensible, too.
Show 26 quoted lines
> diff --git a/builtin/repo.c b/builtin/repo.c
> index 55f9b9095c..b5146499d0 100644
> --- a/builtin/repo.c
> +++ b/builtin/repo.c
> @@ -20,11 +20,17 @@
>  #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,
>  };
>  
>  typedef int get_value_fn(struct repository *repo, struct strbuf *buf);
Previous: Patrick Steinhardt
Message 5 of 5 in “repo: factor repo usage strings into shared macros”
  1. 1/2 repo: factor repo usage strings into shared macrosMahi Kassa, Mar 25, 2026
  2. 2/2 repo: show subcommand-specific help textMahi Kassa, Mar 25, 2026
  3. Junio C HamanoMar 25, 2026
  4. Patrick SteinhardtMar 26, 2026
  5. Junio C HamanoMar 25, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.