On Wed, Jan 15, 2025, at 19:29, Junio C Hamano wrote: > From: Junio C Hamano <gitster@xxxxxxxxx> > Date: Wed, 15 Jan 2025 09:56:23 -0800 > Subject: [PATCH] parse-options: add show_usage_help() > > Many commands call usage_with_options() when they are asked to give > the help message, but it incorrectly sends the help text to the > standard error stream. When the user asked for it with "git cmd -h", > the help message is the primary output from the command, hence we > should send it to the standard output stream. > > Introduce a helper function that captures the common pattern > > if (argc == 2 && !strcmp(argv[1], "-h")) > usage_with_options(usage, options); > > and replaces it with > > show_usage_help(argc, argv, usage, options); > > to help correct code paths (there are 40 or so of them). > > Suggested-by: Jeff King <peff@xxxxxxxx> +Reported-by: Jonas Konrad <jonas.konrad@xxxxxxxxxxxxxxx> > Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> -- Kristoffer Haugsbakk