]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-shortlog.c
Merge branch 'mv/dashless'
[git.git] / builtin-shortlog.c
index 01362022c0990cc785d7bcc77f21802c5e75b3e2..94c4723856924a9643bcaf6c14fd9679667cbbdd 100644 (file)
@@ -10,7 +10,7 @@
 #include "parse-options.h"
 
 static char const * const shortlog_usage[] = {
-       "git-shortlog [-n] [-s] [-e] [-w] [rev-opts] [--] [<commit-id>... ]",
+       "git shortlog [-n] [-s] [-e] [-w] [rev-opts] [--] [<commit-id>... ]",
        "",
        "[rev-opts] are documented in git-rev-list(1)",
        NULL
@@ -154,6 +154,15 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)
        if (!author)
                die("Missing author: %s",
                    sha1_to_hex(commit->object.sha1));
+       if (log->user_format) {
+               struct strbuf buf = STRBUF_INIT;
+
+               pretty_print_commit(CMIT_FMT_USERFORMAT, commit, &buf,
+                       DEFAULT_ABBREV, "", "", DATE_NORMAL, 0);
+               insert_one_record(log, author, buf.buf);
+               strbuf_release(&buf);
+               return;
+       }
        if (*buffer)
                buffer++;
        insert_one_record(log, author, !*buffer ? "<none>" : buffer);
@@ -271,6 +280,8 @@ parse_done:
                usage_with_options(shortlog_usage, options);
        }
 
+       log.user_format = rev.commit_format == CMIT_FMT_USERFORMAT;
+
        /* assume HEAD if from a tty */
        if (!nongit && !rev.pending.nr && isatty(0))
                add_head_to_pending(&rev);