From: Eric Wong Date: Sun, 8 Apr 2007 07:59:22 +0000 (-0700) Subject: git-svn: fix log command to avoid infinite loop on long commit messages X-Git-Tag: v1.5.1.1~7 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c16d08713e2d7f5c440f7649ceb68f838b4b8bea;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/git-svn.perl b/git-svn.perl index e4079fb76..ac44f60b8 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -3263,12 +3263,19 @@ my $l_fmt; sub cmt_showable { my ($c) = @_; return 1 if defined $c->{r}; + + # big commit message got truncated by the 16k pretty buffer in rev-list if ($c->{l} && $c->{l}->[-1] eq "...\n" && $c->{a_raw} =~ /\@([a-f\d\-]+)>$/) { + @{$c->{l}} = (); my @log = command(qw/cat-file commit/, $c->{c}); - shift @log while ($log[0] ne "\n"); + + # shift off the headers + shift @log while ($log[0] ne ''); shift @log; - @{$c->{l}} = grep !/^git-svn-id: /, @log; + + # TODO: make $c->{l} not have a trailing newline in the future + @{$c->{l}} = map { "$_\n" } grep !/^git-svn-id: /, @log; (undef, $c->{r}, undef) = ::extract_metadata( (grep(/^git-svn-id: /, @log))[-1]);