aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/rev-parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/rev-parse.c')
-rw-r--r--builtin/rev-parse.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index e5d70ee6d2..8f61050bde 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -481,6 +481,9 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
if (!s)
s = help;
+ if (s == sb.buf)
+ die(_("missing opt-spec before option flags"));
+
if (s - sb.buf == 1) /* short option only */
o->short_name = *sb.buf;
else if (sb.buf[1] != ',') /* long option only */