summaryrefslogtreecommitdiff
path: root/parse-options.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-03-23 16:04:36 -0700
committerJunio C Hamano <gitster@pobox.com>2014-03-24 10:43:35 -0700
commitb6c2a0d45d4165dfd326bd7a28e66d9cedb8ae84 (patch)
tree9459835f28a86ebc75b876473885e377a286a448 /parse-options.c
parentec160ae12b0ae938ed5076b9f604e88976fc429c (diff)
downloadgit-b6c2a0d45d4165dfd326bd7a28e66d9cedb8ae84.tar.gz
parse-options: make sure argh string does not have SP or _
We encourage to spell an argument hint that consists of multiple words as a single-token separated with dashes. In order to help catching violations added by new callers of parse-options, make sure argh does not contain SP or _ when the code validates the option definitions. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'parse-options.c')
-rw-r--r--parse-options.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/parse-options.c b/parse-options.c
index a5fa0b8938..c81d3a0655 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -375,6 +375,9 @@ static void parse_options_check(const struct option *opts)
default:
; /* ok. (usually accepts an argument) */
}
+ if (opts->argh &&
+ strcspn(opts->argh, " _") != strlen(opts->argh))
+ err |= optbug(opts, "multi-word argh should use dash to separate words");
}
if (err)
exit(128);