X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=builtin-shortlog.c;h=5f9f3f09b11b2e7f54a26bdbce7cb0e6974740d5;hb=cd1dbd37d950f6592d3b84dc95c3863657c3aa7c;hp=90e76ae420389da34c43fd00a665b913d6d503e3;hpb=6a15416a89b8e0095de6dd0d733b4f4545c27d16;p=git.git diff --git a/builtin-shortlog.c b/builtin-shortlog.c index 90e76ae42..5f9f3f09b 100644 --- a/builtin-shortlog.c +++ b/builtin-shortlog.c @@ -29,6 +29,9 @@ static int compare_by_number(const void *a1, const void *a2) return -1; } +const char *format_subject(struct strbuf *sb, const char *msg, + const char *line_separator); + static void insert_one_record(struct shortlog *log, const char *author, const char *oneline) @@ -40,6 +43,7 @@ static void insert_one_record(struct shortlog *log, size_t len; const char *eol; const char *boemail, *eoemail; + struct strbuf subject = STRBUF_INIT; boemail = strchr(author, '<'); if (!boemail) @@ -85,9 +89,8 @@ static void insert_one_record(struct shortlog *log, while (*oneline && isspace(*oneline) && *oneline != '\n') oneline++; len = eol - oneline; - while (len && isspace(oneline[len-1])) - len--; - buffer = xmemdupz(oneline, len); + format_subject(&subject, oneline, " "); + buffer = strbuf_detach(&subject, NULL); if (dot3) { int dot3len = strlen(dot3);