summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2555699)
raw | patch | inline | side by side (parent: 2555699)
author | Junio C Hamano <junkio@cox.net> | |
Wed, 23 May 2007 05:52:59 +0000 (22:52 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 23 May 2007 07:17:51 +0000 (00:17 -0700) |
The parser was inconsistently done, in that it did not look at
the last command line parameter to see if it could be an unknown
option, although it was designed to notice unknown options if
they were given in positions the command expects to find them
(i.e. everything except the last parameter, which ought to be
<commit-ish>). This prevented a very natural invocation
$ git cherry-pick --usage
from issuing the usage help.
Signed-off-by: Junio C Hamano <junkio@cox.net>
the last command line parameter to see if it could be an unknown
option, although it was designed to notice unknown options if
they were given in positions the command expects to find them
(i.e. everything except the last parameter, which ought to be
<commit-ish>). This prevented a very natural invocation
$ git cherry-pick --usage
from issuing the usage help.
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-revert.c | patch | blob | history |
diff --git a/builtin-revert.c b/builtin-revert.c
index ea2f15b977a8b62189755ae89e3ee704b45afae8..80c348c401d1024721012398022eba9ff33f1d34 100644 (file)
--- a/builtin-revert.c
+++ b/builtin-revert.c
if (argc < 2)
usage(usage_str);
- for (i = 1; i < argc - 1; i++) {
+ for (i = 1; i < argc; i++) {
arg = argv[i];
+ if (arg[0] != '-')
+ break;
if (!strcmp(arg, "-n") || !strcmp(arg, "--no-commit"))
no_commit = 1;
else if (!strcmp(arg, "-e") || !strcmp(arg, "--edit"))
else if (strcmp(arg, "-r"))
usage(usage_str);
}
-
+ if (i != argc - 1)
+ usage(usage_str);
arg = argv[argc - 1];
if (get_sha1(arg, sha1))
die ("Cannot find '%s'", arg);