]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
git: local $/ for getline
authorEric Wong <e@80x24.org>
Mon, 28 Dec 2015 00:04:03 +0000 (00:04 +0000)
committerEric Wong <e@80x24.org>
Tue, 5 Apr 2016 18:58:27 +0000 (18:58 +0000)
We may be setting $/ elsewhere, so do not let our callers
inadvertantly break us.

lib/PublicInbox/Git.pm

index aec2db0b3c8ebd36d079c7047c916e9ed38fc8a8..a7e50925878ee97b29aabff26fcc634b01ba97c7 100644 (file)
@@ -40,6 +40,7 @@ sub cat_file_begin {
        $self->{out}->print($obj, "\n") or fail($self, "write error: $!");
 
        my $in = $self->{in};
+       local $/ = "\n";
        my $head = $in->getline;
        $head =~ / missing$/ and return undef;
        $head =~ /^([0-9a-f]{40}) (\S+) (\d+)$/ or
@@ -102,6 +103,7 @@ sub check {
        my ($self, $obj) = @_;
        $self->_bidi_pipe(qw(--batch-check in_c out_c pid_c));
        $self->{out_c}->print($obj, "\n") or fail($self, "write error: $!");
+       local $/ = "\n";
        chomp(my $line = $self->{in_c}->getline);
        my ($hex, $type, $size) = split(' ', $line);
        return if $type eq 'missing';