expose a helper function peel_to_type().
[gitweb.git] / builtin-shortlog.c
index 13df0c668defa3cdf0770bf52fb9d5af399448ee..0055a57aeb24392de0dcf337bb93f30fceccd88f 100644 (file)
@@ -8,7 +8,7 @@
 #include "mailmap.h"
 
 static const char shortlog_usage[] =
-"git-shortlog [-n] [-s] [<commit-id>... ]";
+"git-shortlog [-n] [-s] [-e] [<commit-id>... ]";
 
 static char *common_repo_prefix;
 static int email;
@@ -136,7 +136,8 @@ static void get_from_rev(struct rev_info *rev, struct path_list *list)
 {
        struct commit *commit;
 
-       prepare_revision_walk(rev);
+       if (prepare_revision_walk(rev))
+               die("revision walk setup failed");
        while ((commit = get_revision(rev)) != NULL) {
                const char *author = NULL, *buffer;
 
@@ -249,9 +250,10 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix)
 
        read_mailmap(&mailmap, ".mailmap", &common_repo_prefix);
 
+       /* assume HEAD if from a tty */
+       if (!rev.pending.nr && isatty(0))
+               add_head_to_pending(&rev);
        if (rev.pending.nr == 0) {
-               if (isatty(0))
-                       fprintf(stderr, "(reading log to summarize from standard input)\n");
                read_from_stdin(&list);
        }
        else
@@ -265,7 +267,7 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix)
                struct path_list *onelines = list.items[i].util;
 
                if (summary) {
-                       printf("%s: %d\n", list.items[i].path, onelines->nr);
+                       printf("%6d\t%s\n", onelines->nr, list.items[i].path);
                } else {
                        printf("%s (%d):\n", list.items[i].path, onelines->nr);
                        for (j = onelines->nr - 1; j >= 0; j--) {