Skip to content

Commit c16d087

Browse files
Eric WongJunio C Hamano
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 13c823f commit c16d087

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

git-svn.perl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3263,12 +3263,19 @@ package Git::SVN::Log;
32633263
sub cmt_showable {
32643264
my ($c) = @_;
32653265
return 1 if defined $c->{r};
3266+
3267+
# big commit message got truncated by the 16k pretty buffer in rev-list
32663268
if ($c->{l} && $c->{l}->[-1] eq "...\n" &&
32673269
$c->{a_raw} =~ /\@([a-f\d\-]+)>$/) {
3270+
@{$c->{l}} = ();
32683271
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 '');
32703275
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;
32723279

32733280
(undef, $c->{r}, undef) = ::extract_metadata(
32743281
(grep(/^git-svn-id: /, @log))[-1]);

0 commit comments

Comments
 (0)