shortlog: disallow left-over arguments outside repo
[gitweb.git] / builtin / shortlog.c
index dc4af03fca48fc718d71a15d0d51f2c35aee75a9..3a823b3128259c8f9ee92dbbfaacb492a90e7d6e 100644 (file)
@@ -293,6 +293,11 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix)
 parse_done:
        argc = parse_options_end(&ctx);
 
+       if (nongit && argc > 1) {
+               error(_("too many arguments given outside repository"));
+               usage_with_options(shortlog_usage, options);
+       }
+
        if (setup_revisions(argc, argv, &rev, NULL) != 1) {
                error(_("unrecognized argument: %s"), argv[1]);
                usage_with_options(shortlog_usage, options);