Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Git-Wrapper CPAN distribution.

Report information
The Basics
Id: 56427
Status: resolved
Priority: 0/
Queue: Git-Wrapper

People
Owner: Nobody in particular
Requestors: mgrimes [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: Mark Grimes <mgrimes [...] peculier.com>
Subject: [PATCH] Only strip off the indentation added to the log messages by git
Date: Fri, 9 Apr 2010 09:18:00 -0400
To: bug-Git-Wrapper [...] rt.cpan.org
From: Mark Grimes <mgrimes [...] cpan.org>
From: Mark Grimes <mgrimes@peculier.com> Thanks for Git::Wrapper--it has been a very helpful module. This patch preserves any indentation that the user included in their log messages. It find the indentation of the first line of the log message and then strips off only that much indentation from following line. I have also update the tests in basic.t to check for this behavior. --- lib/Git/Wrapper.pm | 3 ++- t/basic.t | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Git/Wrapper.pm b/lib/Git/Wrapper.pm index 2375a03..7098824 100644 --- a/lib/Git/Wrapper.pm +++ b/lib/Git/Wrapper.pm @@ -113,8 +113,9 @@ sub log { } die "no blank line separating head from message" if $_; my $message = ''; + my ( $initial_indent ) = $out[0] =~ /^(\s*)/ if @out; while (@out and length($_ = shift @out)) { - s/^\s+//; + s/^$initial_indent//; # strip just the indenting added by git $message .= "$_\n"; } $current->message($message); diff --git a/t/basic.t b/t/basic.t index 4f65ac0..ba76f12 100644 --- a/t/basic.t +++ b/t/basic.t @@ -32,7 +32,7 @@ is_deeply( ); my $time = time; -$git->commit({ message => "FIRST" }); +$git->commit({ message => "FIRST\n\n\tBODY\n" }); my @rev_list = $git->rev_list({ all => 1, pretty => 'oneline' }); @@ -52,5 +52,6 @@ my @log = $git->log({ date => 'iso' }); is(@log, 1, 'one log entry'); my $log = $log[0]; is($log->id, (split /\s/, $rev_list[0])[0], 'id'); -is($log->message, "FIRST\n", "message"); +is($log->message, "FIRST\n\n\tBODY\n", "message"); is($log->date, $date, "date"); + -- 1.7.0.2
On Fri Apr 09 09:18:24 2010, MGRIMES wrote: Show quoted text
> From: Mark Grimes <mgrimes@peculier.com> > > Thanks for Git::Wrapper--it has been a very helpful module. > > This patch preserves any indentation that the user included in their > log messages. It find the indentation of the first line of the log > message and then strips off only that much indentation from > following line. > > I have also update the tests in basic.t to check for this > behavior.
Thanks -- I've applied your patch to my repo and it will be in the next release, which should be within the next week, hopefully. thanks, john.