diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-03-04 22:26:33 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-03-04 22:26:33 -0800 |
commit | 868cfe09237430d9d24f17ce2f16c03d4c39b58a (patch) | |
tree | ad42e796c50d427c71730d6c3c53a488af9e1cfc /builtin-shortlog.c | |
parent | 780fc9a0a6d13f667bb012621692107d244998a8 (diff) | |
parent | 462749b728f72079a67202d4d0d1ef19ef993f61 (diff) | |
download | git-868cfe09237430d9d24f17ce2f16c03d4c39b58a.tar.gz git-868cfe09237430d9d24f17ce2f16c03d4c39b58a.tar.xz |
Merge branch 'rs/optim-text-wrap' into maint
* rs/optim-text-wrap:
utf8.c: speculatively assume utf-8 in strbuf_add_wrapped_text()
utf8.c: remove strbuf_write()
utf8.c: remove print_spaces()
utf8.c: remove print_wrapped_text()
Diffstat (limited to 'builtin-shortlog.c')
-rw-r--r-- | builtin-shortlog.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/builtin-shortlog.c b/builtin-shortlog.c index b3b055f68..ecd2d45a0 100644 --- a/builtin-shortlog.c +++ b/builtin-shortlog.c @@ -304,9 +304,19 @@ parse_done: return 0; } +static void add_wrapped_shortlog_msg(struct strbuf *sb, const char *s, + const struct shortlog *log) +{ + int col = strbuf_add_wrapped_text(sb, s, log->in1, log->in2, log->wrap); + if (col != log->wrap) + strbuf_addch(sb, '\n'); +} + void shortlog_output(struct shortlog *log) { int i, j; + struct strbuf sb = STRBUF_INIT; + if (log->sort_by_number) qsort(log->list.items, log->list.nr, sizeof(struct string_list_item), compare_by_number); @@ -321,9 +331,9 @@ void shortlog_output(struct shortlog *log) const char *msg = onelines->items[j].string; if (log->wrap_lines) { - int col = print_wrapped_text(msg, log->in1, log->in2, log->wrap); - if (col != log->wrap) - putchar('\n'); + strbuf_reset(&sb); + add_wrapped_shortlog_msg(&sb, msg, log); + fwrite(sb.buf, sb.len, 1, stdout); } else printf(" %s\n", msg); @@ -337,6 +347,7 @@ void shortlog_output(struct shortlog *log) log->list.items[i].util = NULL; } + strbuf_release(&sb); log->list.strdup_strings = 1; string_list_clear(&log->list, 1); clear_mailmap(&log->mailmap); |