git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] pretty: factor out skip_empty_lines()
@ 2008-12-27  0:32 René Scharfe
  2008-12-27  0:39 ` [PATCH 2/3] pretty: factor out format_subject() René Scharfe
  0 siblings, 1 reply; 15+ messages in thread
From: René Scharfe @ 2008-12-27  0:32 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano

The patch after the next one will use it.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
 pretty.c |   24 +++++++++++++++---------
 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)
-- 
1.6.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2009-01-07 21:21 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-27  0:32 [PATCH 1/3] pretty: factor out skip_empty_lines() René Scharfe
2008-12-27  0:39 ` [PATCH 2/3] pretty: factor out format_subject() René Scharfe
2008-12-27  0:49   ` [PATCH 3/3] pretty: support multiline subjects with format: René Scharfe
2008-12-27 23:24     ` Markus Heidelberg
2008-12-28  0:12       ` René Scharfe
2008-12-28 14:16         ` Markus Heidelberg
2008-12-29 22:15         ` René Scharfe
2009-01-04 10:01           ` Junio C Hamano
2009-01-06 20:41             ` [PATCH 4/3] shortlog: handle multi-line subjects like log --pretty=oneline et. al. do René Scharfe
2009-01-07 21:19               ` Junio C Hamano
2008-12-28  0:13       ` [PATCH 3/3] pretty: support multiline subjects with format: Junio C Hamano
2008-12-28 14:26         ` Markus Heidelberg
2008-12-28  0:09     ` Nanako Shiraishi
2008-12-28  1:44       ` Miklos Vajna
2008-12-28 14:08       ` Markus Heidelberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).