提交 f3a47405 编写于 作者: L Lars Hjemli 提交者: Junio C Hamano

Skip excessive blank lines before commit body

This modifies pretty_print_commit() to make the output of git-rev-list and
friends a bit more predictable.

A commit body starting with blank lines might be unheard-of, but still possible
to create using git-commit-tree (so is bound to appear somewhere, sometime).
Signed-off-by: NLars Hjemli <hjemli@gmail.com>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 f3673988
......@@ -703,7 +703,7 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt,
const char *after_subject,
int relative_date)
{
int hdr = 1, body = 0;
int hdr = 1, body = 0, seen_title = 0;
unsigned long offset = 0;
int indent = 4;
int parents_shown = 0;
......@@ -809,6 +809,8 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt,
body = 1;
if (is_empty_line(line, &linelen)) {
if (!seen_title)
continue;
if (!body)
continue;
if (subject)
......@@ -817,6 +819,7 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt,
break;
}
seen_title = 1;
if (subject) {
int slen = strlen(subject);
memcpy(buf + offset, subject, slen);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册