builtin-verify-tag: fix -v option parsing
Since the C rewrite, "git verify-tag -v" just does nothing instead of printing the usage message with an error. This patch fix the regression. Signed-off-by: Olivier Marin <dkr@freesurf.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Olivier Marin committed
Jul 28, 2008 at 12:48 UTC
d2761895144b6fabcbe1f3bd40d6c6798914b518
1 file changed
+5
-4
builtin-verify-tag.c
+5
-4
@@ -92,14 +92,15 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)
92
93
git_config(git_default_config, NULL);
94
95
- if (argc == 1)
96
- usage(builtin_verify_tag_usage);
97
-
98
- if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--verbose")) {
95
+ if (argc > 1 &&
96
+ (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--verbose"))) {
97
verbose = 1;
98
i++;
99
}
100
101
+ if (argc <= i)
102
+ usage(builtin_verify_tag_usage);
103
+
104
/* sometimes the program was terminated because this signal
105
* was received in the process of writing the gpg input: */
106
signal(SIGPIPE, SIG_IGN);