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

Re: merge --no-ff is NOT mentioned in help

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 17, 2016, 17:10 UTC
Message-ID
<xmqqr36anibl.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CANoM8SVXeeZsc40xgVqZep_9oT=J2h4mOO0Ksn+kb0g8Ct=KrQ@mail.gmail.com>
Mike Rappazzo <rappazzo@gmail.com> writes:
> (Please reply inline)
Indeed ;-)
Show 23 quoted lines
> On Wed, Nov 16, 2016 at 10:48 AM, Vanderhoof, Tzadik
> <tzadik.vanderhoof@optum360.com> wrote:
>> I am running:    git version 2.10.1.windows.1
>>
>> I typed: git merge -h
>>
>> and got:
>>
>> usage: git merge [<options>] [<commit>...]
>>    or: git merge [<options>] <msg> HEAD <commit>
>>    or: git merge --abort
>>
>>     -n                    do not show a diffstat at the end of the merge
>>...
>>     --overwrite-ignore    update ignored files (default)
>>
>> Notice there is NO mention of the "--no-ff" option
>
> I understand.  On my system I can reproduce this by providing a bad
> argument to `git merge`.  This is the output from the arg setup.  For
> "boolean" arguments (like '--ff'), there is an automatic counter
> argument with "no-" in there ('--no-ff') to disable the option.  Maybe
> it would make sense to word the output to include both.

I think that was a deliberate design decision to avoid cluttering the short help text with mention of both --option and --no-option.

People interested may want to try the attached single-liner patch to see how the output from _ALL_ commands that use parse-options API looks when given "-h". It could be that the result may not be too bad.

I suspect that we may discover that some options that should be marked with NONEG are not marked along the way, which need to be fixed.

 parse-options.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/parse-options.c b/parse-options.c
index 312a85dbde..348be6b240 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -626,7 +626,9 @@ static int usage_with_options_internal(struct parse_opt_ctx_t *ctx,
 		if (opts->long_name && opts->short_name)
 			pos += fprintf(outfile, ", ");
 		if (opts->long_name)
-			pos += fprintf(outfile, "--%s", opts->long_name);
+			pos += fprintf(outfile, "--%s%s", 
+				       (opts->flags & PARSE_OPT_NONEG) ? "" : "[no-]",
+				       opts->long_name);
 		if (opts->type == OPTION_NUMBER)
 			pos += utf8_fprintf(outfile, _("-NUM"));
 
Previous: Vanderhoof, TzadikNext: Torsten Bögershausen
Message 6 of 9 in “merge --no-ff is NOT mentioned in help”
  1. Vanderhoof, TzadikNov 16, 2016
  2. Mike RappazzoNov 16, 2016
  3. Vanderhoof, TzadikNov 16, 2016
  4. Mike RappazzoNov 16, 2016
  5. Vanderhoof, TzadikNov 17, 2016
  6. Junio C HamanoNov 17, 2016
  7. Torsten BögershausenNov 17, 2016
  8. Jeff KingNov 17, 2016
  9. Vanderhoof, TzadikNov 18, 2016

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.