X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-shortlog.c;h=edb40429ec4465f3bebba02f2174314dd0183225;hb=fffe694d607ea683b5d08ee99a46d9b06cb74006;hp=f1124e261b04ca93118c662f391dec41d9ee9713;hpb=c3e43938839752b48ff3a36862ae59f1cd1e630d;p=git.git diff --git a/builtin-shortlog.c b/builtin-shortlog.c index f1124e261..edb40429e 100644 --- a/builtin-shortlog.c +++ b/builtin-shortlog.c @@ -4,7 +4,6 @@ #include "diff.h" #include "path-list.h" #include "revision.h" -#include static const char shortlog_usage[] = "git-shortlog [-n] [-s] [... ]"; @@ -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;