On Mon, Mar 03, 2008 at 02:07:57PM +0000, Carlos Rica wrote: > On Sun, Mar 2, 2008 at 5:18 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > > Although "--h" still favors "--hard" over "--help": > > > > $ ./git-reset --h > > HEAD is now at c149184... > > > > Pierre, is there a way to give preference to --help over --hard > when someone uses --h in command line? The problem is that --help (and --help-all for the matter) are "magic" arguments that parse-options is not aware of when it deals with abbreviations. I assume the sole way is to always test against --help (--help-all whom --help is a prefix anyways) for prefixes. So basically we should replace the block in parse-options.c: if (ambiguous_option) ... if (abbrev_option) return get_value(p, abbrev_option, abbrev_flags); with something that basically does: ambiguous: if (ambiguous_option) ... if (abbrev_option) { if (clashes with --help) { ambiguous_option = "help"; ambiguous_flags = 0; goto ambiguous; } return get_value.... } the "if (clashes with --help)" obviously has to be expansed as real code, and should use an array of hardcoded values so that it's extensible if the need arises. -- ·O· Pierre Habouzit ··O madcoder@xxxxxxxxxx OOO http://www.madism.org
Attachment:
pgpYK32Q7f5DY.pgp
Description: PGP signature