Allow the user to control the verbosity of merge-recursive.
[gitweb.git] / builtin-shortlog.c
index f1124e261b04ca93118c662f391dec41d9ee9713..edb40429ec4465f3bebba02f2174314dd0183225 100644 (file)
@@ -4,7 +4,6 @@
 #include "diff.h"
 #include "path-list.h"
 #include "revision.h"
-#include <string.h>
 
 static const char shortlog_usage[] =
 "git-shortlog [-n] [-s] [<commit-id>... ]";
@@ -188,18 +187,25 @@ static void read_from_stdin(struct path_list *list)
                                bob = buffer + strlen(buffer);
                        else {
                                offset = 8;
-                               while (isspace(bob[-1]))
+                               while (buffer + offset < bob &&
+                                      isspace(bob[-1]))
                                        bob--;
                        }
 
                        while (fgets(buffer2, sizeof(buffer2), stdin) &&
                                        buffer2[0] != '\n')
                                ; /* chomp input */
-                       if (fgets(buffer2, sizeof(buffer2), stdin))
+                       if (fgets(buffer2, sizeof(buffer2), stdin)) {
+                               int l2 = strlen(buffer2);
+                               int i;
+                               for (i = 0; i < l2; i++)
+                                       if (!isspace(buffer2[i]))
+                                               break;
                                insert_author_oneline(list,
                                                buffer + offset,
                                                bob - buffer - offset,
-                                               buffer2, strlen(buffer2));
+                                               buffer2 + i, l2 - i);
+                       }
                }
        }
 }
@@ -236,7 +242,7 @@ static void get_from_rev(struct rev_info *rev, struct path_list *list)
                                        author = scratch;
                                        authorlen = strlen(scratch);
                                } else {
-                                       while (bracket[-1] == ' ')
+                                       if (bracket[-1] == ' ')
                                                bracket--;
 
                                        author = buffer + 7;