git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/3] pretty: factor out skip_empty_lines()

From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Dec 27, 2008, 00:32 UTC
Message-ID
<1230337969.8363.84.camel@ubuntu.ubuntu-domain>
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
Next: René Scharfe
Message 1 of 15 in “pretty: factor out skip_empty_lines()”
  1. 1/3 pretty: factor out skip_empty_lines()René Scharfe, Dec 27, 2008
  2. 2/3 pretty: factor out format_subject()René Scharfe, Dec 27, 2008
  3. 3/3 pretty: support multiline subjects with format:René Scharfe, Dec 27, 2008
  4. Markus HeidelbergDec 27, 2008
  5. Nanako ShiraishiDec 28, 2008
  6. Miklos VajnaDec 28, 2008
  7. Markus HeidelbergDec 28, 2008
  8. René ScharfeDec 28, 2008
  9. Markus HeidelbergDec 28, 2008
  10. René ScharfeDec 29, 2008
  11. Junio C HamanoJan 4, 2009
  12. 4/3 shortlog: handle multi-line subjects like log --pretty=oneline et. al. doRené Scharfe, Jan 6, 2009
  13. Junio C HamanoJan 7, 2009
  14. Junio C HamanoDec 28, 2008
  15. Markus HeidelbergDec 28, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.