git-push: documentation and tests for pushing only branches
[gitweb.git] / perl / Git.pm
index 8fd36117539b528173e84f1df3acfc754ccc868f..3f4080cbf84e16ab3dd21a82d9948c5646c1c40f 100644 (file)
@@ -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 {