summaryrefslogtreecommitdiff
path: root/Documentation/technical/api-parse-options.txt
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2009-03-09 20:57:38 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-03-09 22:32:50 (GMT)
commit0d260f9a09a2febeb86fdada7224d271a76d2e3c (patch)
treefc941df4ea65bc64faf78bfe93a877554a72dccd /Documentation/technical/api-parse-options.txt
parent9ad7e6ea24739c298d0a9660121de6df0502915a (diff)
downloadgit-0d260f9a09a2febeb86fdada7224d271a76d2e3c.zip
git-0d260f9a09a2febeb86fdada7224d271a76d2e3c.tar.gz
git-0d260f9a09a2febeb86fdada7224d271a76d2e3c.tar.bz2
parseopt: prevent KEEP_UNKNOWN and STOP_AT_NON_OPTION from being used together
As suggested by Junio, disallow the flags PARSE_OPT_KEEP_UNKNOWN and PARSE_OPT_STOP_AT_NON_OPTION to be turned on at the same time, as a value of an unknown option could be mistakenly classified as a non-option, stopping the parser early. E.g.: git cmd --known --unknown value arg0 arg1 The parser should have stopped at "arg0", but it already stops at "value". This patch makes parse_options() die if the two flags are used in combination. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/technical/api-parse-options.txt')
-rw-r--r--Documentation/technical/api-parse-options.txt3
1 files changed, 2 insertions, 1 deletions
diff --git a/Documentation/technical/api-parse-options.txt b/Documentation/technical/api-parse-options.txt
index 20b44ff..e66ca9f 100644
--- a/Documentation/technical/api-parse-options.txt
+++ b/Documentation/technical/api-parse-options.txt
@@ -96,7 +96,8 @@ Flags are the bitwise-or of:
`PARSE_OPT_STOP_AT_NON_OPTION` is set, the second argument in
`--unknown value` will be mistakenly interpreted as a
non-option, not as a value belonging to the unknown option,
- stopping the parser early.
+ the parser early. That's why parse_options() errors out if
+ both options are set.
`PARSE_OPT_NO_INTERNAL_HELP`::
By default, parse_options() handles `-h`, `--help` and