git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rolf Bjarne Kvinge" <RKvinge@novell.com>
To: "Junio C Hamano" <gitster@pobox.com>
Cc: "Nanako Shiraishi" <nanako3@lavabit.com>, git@vger.kernel.org
Subject: Re: Unapplied patches reminder
Date: Mon, 19 Oct 2009 13:57:29 +0200	[thread overview]
Message-ID: <op.u11p53ryk71drc@linux.home> (raw)
In-Reply-To: <7vzl7ogtxs.fsf@alter.siamese.dyndns.org>

[-- Attachment #1: Type: text/plain, Size: 2266 bytes --]

On Mon, 19 Oct 2009 01:31:59 +0200, Junio C Hamano <gitster@pobox.com> wrote:

> 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/

[-- Attachment #2: 0001-pretty.c-Don-t-do-any-transformations-when-using-the.patch --]
[-- Type: application/octet-stream, Size: 0 bytes --]



[-- Attachment #3: 0001-pretty.c-special-case-raw-format.patch --]
[-- Type: application/octet-stream, Size: 874 bytes --]

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


  reply	other threads:[~2009-10-19 11:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-18 20:20 Unapplied patches reminder Nanako Shiraishi
2009-10-18 23:31 ` Junio C Hamano
2009-10-18 23:31 ` Junio C Hamano
2009-10-19  8:10   ` Heiko Voigt
2009-10-18 23:31 ` Junio C Hamano
2009-10-19  6:49   ` Jeff King
2009-10-19  8:05     ` Junio C Hamano
2009-10-18 23:31 ` Junio C Hamano
2009-10-19 11:57   ` Rolf Bjarne Kvinge [this message]
2009-10-19 13:08   ` Per Strandh
2009-10-18 23:32 ` Junio C Hamano
2009-10-18 23:32 ` Junio C Hamano
2009-12-07  3:03   ` Greg Price
2009-10-18 23:32 ` Junio C Hamano
2009-10-18 23:32 ` Junio C Hamano

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.u11p53ryk71drc@linux.home \
    --to=rkvinge@novell.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=nanako3@lavabit.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).