diff options
Diffstat (limited to 'perl')
-rw-r--r-- | perl/Git.pm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/perl/Git.pm b/perl/Git.pm index 8fd361175..3f4080cbf 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 { |