]> git.ipfire.org Git - thirdparty/git.git/commit
parse-options: move NODASH sanity checks to parse_options_check
authorJonathan Nieder <jrnieder@gmail.com>
Thu, 2 Dec 2010 06:05:05 +0000 (00:05 -0600)
committerJunio C Hamano <gitster@pobox.com>
Tue, 7 Dec 2010 22:17:49 +0000 (14:17 -0800)
commita02dd4ff7dd79eb6aa39b00c90c293e3c3d10b4c
tree544477a27a6aafe9d797d23e4b6018d11abe26d2
parent1e5ce570ca368b97c8e3b238bb0228c5ca41b494
parse-options: move NODASH sanity checks to parse_options_check

A dashless switch (like '(' passed to 'git grep') cannot be negated,
cannot be attached to an argument, and cannot have a long form.
Currently parse-options runs the related sanity checks when the
dashless option is used; better to always check them at the start of
option parsing, so mistakes can be caught more quickly.

The error message at the new call site is less specific about the
nature of the error, for simplicity.  On the other hand, it prints
which switch was problematic.  Before:

fatal: BUG: dashless options can't be long

After:

error: BUG: switch '(' uses feature not supported for dashless options

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
parse-options.c