From: Jonathan Nieder Date: Thu, 2 Dec 2010 06:01:18 +0000 (-0600) Subject: parse-options: clearer reporting of API misuse X-Git-Tag: v1.7.4-rc0~51^2~8 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/1e5ce570ca368b97c8e3b238bb0228c5ca41b494?ds=inline;hp=1e5ce570ca368b97c8e3b238bb0228c5ca41b494 parse-options: clearer reporting of API misuse The PARSE_OPT_LASTARG_DEFAULT flag is meant for options like --contains that (1) traditionally had a mandatory argument and (2) have some better behavior to use when appearing in the final position. It makes no sense to combine this with OPTARG, so ever since v1.6.4-rc0~71 (parse-options: add parse_options_check to validate option specs, 2009-07-09) this mistake is flagged with error: `--option` uses incompatible flags LASTARG_DEFAULT and OPTARG and an exit status representing an error in commandline usage. Unfortunately that which might confuse scripters calling such an erroneous program into thinking the _script_ contains an error. Clarify that it is an internal error by dying with a message beginning "error: BUG: ..." and status 128. While at it, clean up parse_options_check to prepare for more checks. Long term, it would be nicer to make such checks happen at compile time. Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano ---