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

git rev-list --pretty=raw strips empty lines

From
RKRolf Bjarne Kvinge <rkvinge@novell.com>
Date
Oct 6, 2009, 12:33 UTC
Message-ID
<op.u1do6bq5k71drc@linux.lacasa>
Hi,
It seems like the --pretty=raw format strips off empty newlines from the beginning of log messages, while I'd expect the raw format to not do any transformations (just as the documentation says: "The 'raw' format shows the entire commit exactly as stored in the commit object").
I've attached a test script that I can use to reproduce with current master (dbc1b1f71052c0)
The below changes works for me, not sure if I'm right about this though (my first time here ;-)
Rolf
diff --git a/pretty.c b/pretty.c
index f5983f8..1037700 100644
--- a/pretty.c
+++ b/pretty.c
@@ -868,7 +868,7 @@ void pp_remainder(enum cmit_fmt fmt,
                         break;

                 if (is_empty_line(line, &linelen)) {
-                       if (first)
+                       if (first && fmt != CMIT_FMT_RAW)
                                 continue;
                         if (fmt == CMIT_FMT_SHORT)
                                 break;
@@ -952,7 +952,8 @@ void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,
         }

         /* Skip excess blank lines at the beginning of body, if any... */
-       msg = skip_empty_lines(msg);
+       if (fmt != CMIT_FMT_RAW)
+               msg = skip_empty_lines(msg);

         /* These formats treat the title line specially. */
         if (fmt == CMIT_FMT_ONELINE || fmt == CMIT_FMT_EMAIL)
-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Message 1 of 1 in “git rev-list --pretty=raw strips empty lines”
  1. Rolf Bjarne KvingeOct 6, 2009

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.