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

[PATCH] Fix git-remote for ActiveState Perl

From
Alex Riesen <raa.lkml@gmail.com>
Date
Aug 22, 2007, 16:13 UTC
Message-ID
<20070822161307.GA3528@steel.home>

For reason unknown a package in ActiveState Perl 5.8.7 must implement READLINE method differently for scalar and array context. The code tested to work for more sane and recent version of perl (5.8.8 shipped with Ubuntu), so maybe it was always a requirement.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---

Without this only the first remote can be used if you are unlucky enough to use that perl. There are probably more breakages, as only first line of a file/stream can be read. Not many use Git.pm on Windows and ActiveState Perl, so it went unnoticed for long time.

 perl/Git.pm |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/perl/Git.pm b/perl/Git.pm
index 8fd3611..3f4080c 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -860,7 +860,13 @@ sub READLINE {
 	if ($self->{i} >= scalar @{$self->{data}}) {
 		return undef;
 	}
-	return $self->{'data'}->[ $self->{i}++ ];
+	my $i = $self->{i};
+	if (wantarray) {
+		$self->{i} = $#{$self->{'data'}} + 1;
+		return splice(@{$self->{'data'}}, $i);
+	}
+	$self->{i} = $i + 1;
+	return $self->{'data'}->[ $i ];
 }
 
 sub CLOSE {
-- 
1.5.3.rc6.19.g4d600f
Next: Junio C Hamano
Message 1 of 2 in “Fix git-remote for ActiveState Perl”
  1. Fix git-remote for ActiveState PerlAlex Riesen, Aug 22, 2007
  2. Junio C HamanoAug 22, 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.