Code

parse-options: allow positivation of options starting, with no-
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>
Sat, 25 Feb 2012 19:14:54 +0000 (20:14 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sun, 26 Feb 2012 23:32:53 +0000 (15:32 -0800)
commit0f1930c58754a821bd51087ca4676e6a69cd4d2b
treefa499d19a52980a2a7947e5235a188b813db1287
parentb9e63ddddc8928f39db6658bf6428a9b646e5ea5
parse-options: allow positivation of options starting, with no-

Long options can be negated by adding no- right after the leading
two dashes. This is useful e.g. to override options set by aliases.

For options that are defined to start with no- already, this looks
a bit funny. Allow such options to also be negated by removing the
prefix.

The following thirteen options are affected:

apply          --no-add
bisect--helper --no-checkout
checkout-index --no-create
clone          --no-checkout --no-hardlinks
commit         --no-verify   --no-post-rewrite
format-patch   --no-binary
hash-object    --no-filters
read-tree      --no-sparse-checkout
revert         --no-commit
show-branch    --no-name
update-ref     --no-deref

The following five are NOT affected because they are defined with
PARSE_OPT_NONEG or the non-negated version is defined as well:

branch       --no-merged
format-patch --no-stat             --no-numbered
update-index --no-assume-unchanged --no-skip-worktree

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/technical/api-parse-options.txt
parse-options.c
t/t0040-parse-options.sh