update-index: do not die too early in a read-only repository.
[gitweb.git] / builtin-shortlog.c
index 3322c3a2eef3f331ea716690039c8b38bf4a6fd0..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,7 +187,8 @@ static void read_from_stdin(struct path_list *list)
                                bob = buffer + strlen(buffer);
                        else {
                                offset = 8;
-                               if (isspace(bob[-1]))
+                               while (buffer + offset < bob &&
+                                      isspace(bob[-1]))
                                        bob--;
                        }