From: "Rolf Bjarne Kvinge" <RKvinge@novell•com>
To: git@vger•kernel.org
Subject: git rev-list --pretty=raw strips empty lines
Date: Tue, 06 Oct 2009 14:33:37 +0200 [thread overview]
Message-ID: <op.u1do6bq5k71drc@linux.lacasa> (raw)
[-- Attachment #1: Type: text/plain, Size: 1443 bytes --]
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/
[-- Attachment #2: test.sh --]
[-- Type: application/octet-stream, Size: 652 bytes --]
#!/bin/bash -e
cat > msg << EOF
first line
EOF
# the following exports are just to make the size of the rev-list output only dependent on the size of the log message
export GIT_COMMITTER_NAME=Bar
export GIT_COMMITTER_EMAIL="bar@foo•com"
export GIT_COMMITTER_DATE="2000/01/01 00:00"
export GIT_AUTHOR_NAME=Foo
export GIT_AUTHOR_EMAIL="foo@bar•com"
export GIT_AUTHOR_DATE="2000/01/01 00:00"
git add msg
git commit -F msg --cleanup=verbatim
git rev-list --pretty=raw -1 HEAD | tee msg.tmp
SIZE=`cat msg.tmp | wc -c`
# current master gives a message length of 244
echo Expected message length: 259, got message length: $SIZE
git reset HEAD^ --hard
reply other threads:[~2009-10-06 12:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=op.u1do6bq5k71drc@linux.lacasa \
--to=rkvinge@novell$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox