From 5f0df44cd79a953c287ccb598896ea7aaa2cc9e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Thu, 2 Aug 2018 21:18:14 +0200 Subject: parse-options: automatically infer PARSE_OPT_LITERAL_ARGHELP Parseopt wraps argument help strings in a pair of angular brackets by default, to tell users that they need to replace it with an actual value. This is useful in most cases, because most option arguments are indeed single values of a certain type. The option PARSE_OPT_LITERAL_ARGHELP needs to be used in option definitions with arguments that have multiple parts or are literal strings. Stop adding these angular brackets if special characters are present, as they indicate that we don't deal with a simple placeholder. This simplifies the code a bit and makes defining special options slightly easier. Remove the flag PARSE_OPT_LITERAL_ARGHELP in the cases where the new and more cautious handling suffices. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- builtin/send-pack.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'builtin/send-pack.c') diff --git a/builtin/send-pack.c b/builtin/send-pack.c index c8af374dee..a4f7dea115 100644 --- a/builtin/send-pack.c +++ b/builtin/send-pack.c @@ -179,8 +179,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix) { OPTION_CALLBACK, 0, CAS_OPT_NAME, &cas, N_(":"), N_("require old value of ref to be at this value"), - PARSE_OPT_OPTARG | PARSE_OPT_LITERAL_ARGHELP, - parseopt_push_cas_option }, + PARSE_OPT_OPTARG, parseopt_push_cas_option }, OPT_END() }; -- cgit v1.2.1