git-svn: fix log command to avoid infinite loop on long commit messages
This bug has been around since the the conversion to use the Git.pm library back in October or November. Eventually I'd like "git rev-list/log" to have the option to not truncate overly long messages. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
Eric Wong committed
Apr 8, 2007 at 00:59 UTC
c16d08713e2d7f5c440f7649ceb68f838b4b8bea
1 file changed
+9
-2
git-svn.perl
+9
-2
@@ -3263,12 +3263,19 @@ my $l_fmt;
3263
sub cmt_showable {
3264
my ($c) = @_;
3265
return 1 if defined $c->{r};
3266
+
3267
+ # big commit message got truncated by the 16k pretty buffer in rev-list
3268
if ($c->{l} && $c->{l}->[-1] eq "...\n" &&
3269
$c->{a_raw} =~ /\@([a-f\d\-]+)>$/) {
3270
+ @{$c->{l}} = ();
3271
my @log = command(qw/cat-file commit/, $c->{c});
3269
- shift @log while ($log[0] ne "\n");
3272
+
3273
+ # shift off the headers
3274
+ shift @log while ($log[0] ne '');
3275
shift @log;
3271
- @{$c->{l}} = grep !/^git-svn-id: /, @log;
3276
+
3277
+ # TODO: make $c->{l} not have a trailing newline in the future
3278
+ @{$c->{l}} = map { "$_\n" } grep !/^git-svn-id: /, @log;
3279
3280
(undef, $c->{r}, undef) = ::extract_metadata(
3281
(grep(/^git-svn-id: /, @log))[-1]);