parse-options: ambiguous LASTARG_DEFAULT and OPTARG
- From
Stephen Boyd <bebarino@gmail.com>
- Date
- Jun 5, 2009, 05:43 UTC
- Message-ID
- <4A28B072.8030006@gmail.com>
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 --verbosebut
$ 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.