git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
EWEric Wong <normalperson@yhbt.net>
Date
Apr 8, 2007, 07:59 UTC
Message-ID
<11760191623184-git-send-email-normalperson@yhbt.net>

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>
---
 git-svn.perl |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index e4079fb..ac44f60 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]);
-- 
1.5.1.82.g8c65-dirty
Message 1 of 1 in “git-svn: fix log command to avoid infinite loop on long commit messages”
  1. git-svn: fix log command to avoid infinite loop on long commit messagesEric Wong, Apr 8, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.