summaryrefslogtreecommitdiff
path: root/pretty.c
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2008-12-27 00:32:49 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-12-27 20:02:32 (GMT)
commita010966844221ea14f1de26fdab8fe37332ff928 (patch)
treebbd3a8b71e88466c31e704ad06e1a81661e0c080 /pretty.c
parent8104ebfe8276657ee803cca7eb8665a78cf3ef83 (diff)
downloadgit-a010966844221ea14f1de26fdab8fe37332ff928.zip
git-a010966844221ea14f1de26fdab8fe37332ff928.tar.gz
git-a010966844221ea14f1de26fdab8fe37332ff928.tar.bz2
pretty: factor out skip_empty_lines()
The patch after the next one will use it. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/pretty.c b/pretty.c
index f6ff312..c43497b 100644
--- a/pretty.c
+++ b/pretty.c
@@ -181,6 +181,20 @@ static int is_empty_line(const char *line, int *len_p)
return !len;
}
+static const char *skip_empty_lines(const char *msg)
+{
+ for (;;) {
+ int linelen = get_one_line(msg);
+ int ll = linelen;
+ if (!linelen)
+ break;
+ if (!is_empty_line(msg, &ll))
+ break;
+ msg += linelen;
+ }
+ return msg;
+}
+
static void add_merge_info(enum cmit_fmt fmt, struct strbuf *sb,
const struct commit *commit, int abbrev)
{
@@ -850,15 +864,7 @@ void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,
}
/* Skip excess blank lines at the beginning of body, if any... */
- for (;;) {
- int linelen = get_one_line(msg);
- int ll = linelen;
- if (!linelen)
- break;
- if (!is_empty_line(msg, &ll))
- break;
- msg += linelen;
- }
+ msg = skip_empty_lines(msg);
/* These formats treat the title line specially. */
if (fmt == CMIT_FMT_ONELINE || fmt == CMIT_FMT_EMAIL)