Skip to content

Commit

Permalink
git-svn: fix log command to avoid infinite loop on long commit messages
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Wong authored and Junio C Hamano committed Apr 9, 2007
1 parent 13c823f commit c16d087
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions git-svn.perl
Original file line number Diff line number Diff line change
Expand Up @@ -3263,12 +3263,19 @@ package Git::SVN::Log;
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]);
Expand Down

0 comments on commit c16d087

Please sign in to comment.