You can now truncate a given placeholder to no more than a certain number of characters with something like "%30s". Signed-off-by: Jeff King <peff@xxxxxxxx> --- This just uses the made-up "%30s" syntax, but you could easily tweak it to handle "%.30s" or whatever. pretty.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/pretty.c b/pretty.c index 7b4d098..06d96a7 100644 --- a/pretty.c +++ b/pretty.c @@ -1019,6 +1019,7 @@ static size_t format_commit_item(struct strbuf *sb, const char *placeholder, { int consumed; int magic_len = 0; + int max_len = 0; size_t orig_len; enum { NO_MAGIC, @@ -1045,9 +1046,22 @@ static size_t format_commit_item(struct strbuf *sb, const char *placeholder, placeholder++; } + if (isdigit(placeholder[0])) { + char *end; + max_len = strtoul(placeholder, &end, 10); + magic_len += (end - placeholder); + placeholder = end; + } + orig_len = sb->len; consumed = format_commit_one(sb, placeholder, context); + if (max_len) { + size_t end = orig_len + max_len; + if (end < sb->len) + strbuf_setlen(sb, end); + } + if ((orig_len == sb->len) && magic == DEL_LF_BEFORE_EMPTY) { while (sb->len && sb->buf[sb->len - 1] == '\n') strbuf_setlen(sb, sb->len - 1); -- 1.7.8.1.3.gba11d -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html