Re: Unapplied patches reminder
On Mon, 19 Oct 2009 01:31:59 +0200, Junio C Hamano <gitster@pobox.com> wrote:
Show 31 quoted lines
> Nanako Shiraishi <nanako3@lavabit.com> writes:
>
>> Junio, I saw these patches and thought what they try to do were
>> sensible, but I don't them in your tree. I didn't see much discussion
>> on most of them, either.
>>
>> Because I don't read C very well, I may have listed some patches
>> here that you may have discarded because the code was no good, and
>> if so I apologize for wasting your time, but I thought at least
>> some of them should be salvaged.
>> ...
>> From: "Rolf Bjarne Kvinge" <RKvinge@novell.com>
>> Subject: git rev-list --pretty=raw strips empty lines
>> Date: Tue, 06 Oct 2009 14:33:37 +0200
>> Message-ID: <op.u1do6bq5k71drc@linux.lacasa>
>>
>> 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").
>>
>> The below changes works for me, not sure if I'm right about this
>> though (my first time here ;-)
>
> I do not recall seeing this one; most likely it was lost in the noise,
> especially because it did not look like a patch submission, without having
> anything resembling a commit log message.
>
> I think the change itself is an uncontroversial one, even though this
> really changes the behaviour.
My specific need is to be able to get out the exact same log message as I committed, another way of getting the same result would be to implement --pretty=xml (along the lines of subversions 'svn log --xml'). This would prevent behavioural changes. And yes, I'm willing to implement it if you agree it's a good idea.
Regarding the previous patch I just found that it's not complete - git would still print lines with only whitespace as empty lines (i.e. stripping off the whitespace). I'm attaching a revised patch that fixes this issue, but since I found the resulting code slightly ugly, I also found an easier approach: in pretty_print_commit (pretty.c) just print the commit message buffer and return.
Rolf
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
From 4fa9e4c1c133fbe3423c979efd5722dd7bd5d530 Mon Sep 17 00:00:00 2001
From: Rolf Bjarne Kvinge <RKvinge@novell.com>
Date: Mon, 19 Oct 2009 13:31:17 +0200
Subject: [PATCH] pretty.c: Don't do any transformations when using the 'raw' format.
When formatting commits with the 'raw' format, print the commit exactly as
stored.
Signed-off-by: Rolf Bjarne Kvinge <RKvinge@novell.com>
---
pretty.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/pretty.c b/pretty.c
index f5983f8..96dac9a 100644
--- a/pretty.c
+++ b/pretty.c
@@ -915,6 +915,11 @@ void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,
return;
}
+ if (fmt == CMIT_FMT_RAW) {
+ strbuf_add(sb, msg, strlen (msg));
+ return;
+ }
+
reencoded = reencode_commit_message(commit, &encoding);
if (reencoded) {
msg = reencoded;
--
1.6.5.rc2.17.gdbc1b.dirty