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

Re: Unapplied patches reminder

From
RKRolf Bjarne Kvinge <rkvinge@novell.com>
Date
Oct 19, 2009, 11:57 UTC
Message-ID
<op.u11p53ryk71drc@linux.home>
In-Reply-To
<7vzl7ogtxs.fsf@alter.siamese.dyndns.org>
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
Previous: Junio C HamanoNext: Per Strandh
Message 9 of 15 in “Unapplied patches reminder”
  1. Nanako ShiraishiOct 18, 2009
  2. Junio C HamanoOct 18, 2009
  3. Junio C HamanoOct 18, 2009
  4. Heiko VoigtOct 19, 2009
  5. Junio C HamanoOct 18, 2009
  6. Jeff KingOct 19, 2009
  7. Junio C HamanoOct 19, 2009
  8. Junio C HamanoOct 18, 2009
  9. Rolf Bjarne KvingeOct 19, 2009
  10. Per StrandhOct 19, 2009
  11. Junio C HamanoOct 18, 2009
  12. Junio C HamanoOct 18, 2009
  13. Greg PriceDec 7, 2009
  14. Junio C HamanoOct 18, 2009
  15. Junio C HamanoOct 18, 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.