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

Re: [PATCH 2/2] ls-remote: use PARSE_OPT_NO_INTERNAL_HELP

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 17, 2017, 17:42 UTC
Message-ID
<20171017174241.zph32u74k6bmir7v@aiede.mtv.corp.google.com>
In-Reply-To
<f66f3fc2-8f51-03f5-c242-cb6d776af585@web.de>
René Scharfe wrote:
Show 15 quoted lines
> Since ba5f28bf79 (ls-remote: use parse-options api) git ls-remote -h
> without any other options has shown the short help text of the command
> instead of acting as the short equivalent of --heads.  Fix this
> regression by turning off internal handling of -h for repository setup,
> and option parsing, as well as the corresponding test in t0012.
>
> Reported-by: Thomas Rikl <trikl@online.de>
> Analyzed-by: Martin Ågren <martin.agren@gmail.com>
> Signed-off-by: Rene Scharfe <l.s.r@web.de>
> ---
>  builtin/ls-remote.c  | 1 +
>  git.c                | 2 +-
>  t/t0012-help.sh      | 1 +
>  t/t5512-ls-remote.sh | 6 ++++++
>  4 files changed, 9 insertions(+), 1 deletion(-)
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
[...]
Show 8 quoted lines
> --- a/git.c
> +++ b/git.c
> @@ -421,7 +421,7 @@ static struct cmd_struct commands[] = {
>  	{ "interpret-trailers", cmd_interpret_trailers, RUN_SETUP_GENTLY },
>  	{ "log", cmd_log, RUN_SETUP },
>  	{ "ls-files", cmd_ls_files, RUN_SETUP },
> -	{ "ls-remote", cmd_ls_remote, RUN_SETUP_GENTLY },
> +	{ "ls-remote", cmd_ls_remote, RUN_SETUP_GENTLY | NO_INTERNAL_HELP },

There's only one other command that uses PARSE_OPT_NO_INTERNAL_HELP, and that's "git archive". Does it need the same treatment?

More generally, is there a straightforward way for parse-options or some compile-time analysis to catch if we forget to add NO_INTERNAL_HELP to a command in the commands[] table?

Thanks, Jonathan

Previous: René ScharfeNext: Martin Ågren
Message 22 of 23 in “Bug: git ls-remote -h / --head results differ in output”
  1. Thomas RiklOct 15, 2017
  2. Martin ÅgrenOct 15, 2017
  3. René ScharfeOct 15, 2017
  4. 1/2 git: add NO_INTERNAL_HELP flag for builtinsRené Scharfe, Oct 17, 2017
  5. Jonathan NiederOct 17, 2017
  6. ls-remote: deprecate -h as short for --headsRené Scharfe, Oct 17, 2017
  7. Martin ÅgrenOct 17, 2017
  8. Jonathan NiederOct 17, 2017
  9. Junio C HamanoOct 17, 2017
  10. René ScharfeOct 19, 2017
  11. Jeff KingOct 19, 2017
  12. Junio C HamanoOct 20, 2017
  13. Jeff KingOct 20, 2017
  14. Junio C HamanoOct 20, 2017
  15. Jeff KingOct 21, 2017
  16. René ScharfeOct 21, 2017
  17. Junio C HamanoOct 21, 2017
  18. René ScharfeOct 23, 2017
  19. Junio C HamanoOct 24, 2017
  20. René ScharfeOct 24, 2017
  21. 2/2 ls-remote: use PARSE_OPT_NO_INTERNAL_HELPRené Scharfe, Oct 17, 2017
  22. Jonathan NiederOct 17, 2017
  23. Martin ÅgrenOct 17, 2017

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.