diff options
| author | Junio C Hamano <gitster@pobox.com> | 2022-09-13 11:38:25 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-09-13 11:38:25 -0700 |
| commit | de1fee2f1e730310aa14fae3c3603450c538cf72 (patch) | |
| tree | 97662e0bcf5cc24fd4fe9df5697b6277d91dbdc2 /builtin | |
| parent | Merge branch 'js/builtin-add-p-portability-fix' (diff) | |
| parent | rev-parse --parseopt: detect missing opt-spec (diff) | |
| download | git-de1fee2f1e730310aa14fae3c3603450c538cf72.tar.gz git-de1fee2f1e730310aa14fae3c3603450c538cf72.zip | |
Merge branch 'ow/rev-parse-parseopt-fix'
The parser in the script interface to parse-options in "git
rev-parse" has been updated to diagnose a bogus input correctly.
* ow/rev-parse-parseopt-fix:
rev-parse --parseopt: detect missing opt-spec
Diffstat (limited to 'builtin')
| -rw-r--r-- | builtin/rev-parse.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index b259d8990a..85c271acd7 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -479,6 +479,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 */ |
