Add some basic tests of rev-list --pretty=format
[gitweb.git] / builtin-shortlog.c
index 2f71a2a6e2ecf556956a0271d8af9ad852d5a93c..29343aefc843c4dd22095f559262bc6b5e381440 100644 (file)
@@ -217,13 +217,13 @@ static void get_from_rev(struct rev_info *rev, struct path_list *list)
 
        prepare_revision_walk(rev);
        while ((commit = get_revision(rev)) != NULL) {
-               char *author = NULL, *oneline, *buffer;
+               const char *author = NULL, *oneline, *buffer;
                int authorlen = authorlen, onelinelen;
 
                /* get author and oneline */
                for (buffer = commit->buffer; buffer && *buffer != '\0' &&
                                *buffer != '\n'; ) {
-                       char *eol = strchr(buffer, '\n');
+                       const char *eol = strchr(buffer, '\n');
 
                        if (eol == NULL)
                                eol = buffer + strlen(buffer);
@@ -304,8 +304,11 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix)
        if (!access(".mailmap", R_OK))
                read_mailmap(".mailmap");
 
-       if (rev.pending.nr == 0)
+       if (rev.pending.nr == 0) {
+               if (isatty(0))
+                       fprintf(stderr, "(reading log to summarize from standard input)\n");
                read_from_stdin(&list);
+       }
        else
                get_from_rev(&rev, &list);