summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2007-01-03 13:34:13 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-01-03 16:29:01 (GMT)
commitf3a47405bb27846d62d20b056817f9c7d320e2db (patch)
tree439cfbe00ac5b6e083e85e300c601a11e80e340f /commit.c
parentf3673988ecb3d3174f9b6d3d04f00774b1b5c261 (diff)
downloadgit-f3a47405bb27846d62d20b056817f9c7d320e2db.zip
git-f3a47405bb27846d62d20b056817f9c7d320e2db.tar.gz
git-f3a47405bb27846d62d20b056817f9c7d320e2db.tar.bz2
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: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/commit.c b/commit.c
index 544e426..2a58175 100644
--- a/commit.c
+++ b/commit.c
@@ -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);