git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* parse-options: ambiguous LASTARG_DEFAULT and OPTARG
@ 2009-06-05  5:43 Stephen Boyd
  2009-06-06 10:30 ` René Scharfe
  0 siblings, 1 reply; 9+ messages in thread
From: Stephen Boyd @ 2009-06-05  5:43 UTC (permalink / raw)
  To: git list; +Cc: René Scharfe, Junio C Hamano

Hi,

This in builtin-branch.c

        {
		OPTION_CALLBACK, 0, "merged", &merge_filter_ref,
		"commit", "print only merged branches",
		PARSE_OPT_LASTARG_DEFAULT | PARSE_OPT_NONEG,
		opt_parse_merge_filter, (intptr_t) "HEAD",
	},

and the usage message for "git-branch -h" will print out

    --merged <commit>

when I'm expecting

    --merged[=<commit>]

This is because the PARSE_OPT_OPTARG flag is not used. Is this correct?
The default value is still set correctly in some cases, but become
ambiguous in other cases. Take this for example

    $ git branch --merged --verbose
    fatal: malformed object name --verbose

but

    $ git branch --verbose --merged

works fine.

The simple fix is to just add PARSE_OPT_OPTARG to the flags, and fix a
test or two. But I'm wondering if doing that will become problematic for
end-users. Essentially you can no longer do git branch --merged master,
you must do git branch --merged=master.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-06-12 21:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-05  5:43 parse-options: ambiguous LASTARG_DEFAULT and OPTARG Stephen Boyd
2009-06-06 10:30 ` René Scharfe
2009-06-06 20:14   ` Stephen Boyd
2009-06-07 23:39     ` [PATCH] show-branch: don't use LASTARG_DEFAULT with OPTARG Stephen Boyd
2009-06-08 17:24       ` René Scharfe
2009-06-08 21:56       ` Junio C Hamano
2009-06-09  8:23         ` [PATCH] parse-options: add parse_options_check to validate option specs Pierre Habouzit
2009-06-12 19:31           ` Pierre Habouzit
2009-06-12 21:25             ` René Scharfe

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).