Skip to contentSkip to conversation

git-svn: fix log command to avoid infinite loop on long commit messages

PATCH New Eric Wong 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore

Eric Wong

author
#0 lore raw

PATCH 1/1 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.

---
 git-svn.perl |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
git-svn.perl +9 -2
index e4079fb..ac44f60 100755
@@ -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]);
Signature · 1 line
1.5.1.82.g8c65-dirty