Skip to content

Commit 51db271

Browse files
avargitster
authored andcommitted
git-svn: avoid warning on undef readline()
Change code in Git.pm that sometimes calls chomp() on undef to only do so the value is defined. This code has been chomping undef values ever since it was added in b26098f ("git-svn: reduce scope of input record separator change", 2016-10-14), but started warning due to the introduction of "use warnings" to Git.pm in my f0e19cb ("Git.pm: add the "use warnings" pragma", 2018-02-25) released with 2.17.0. Since this function will return undef in those cases it's still possible that the code using it will warn if it does a chomp of its own, as the code added in b26098f ("git-svn: reduce scope of input record separator change", 2016-10-14) might do, but since git-svn has "use warnings" already that's clearly not a codepath that's going to warn. See https://public-inbox.org/git/[email protected]/ for the original report. Reported-by: Joseph Mingrone <[email protected]> Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Improved-by: Eric Wong <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b26098f commit 51db271

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

perl/Git.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ sub get_record {
549549
my ($fh, $rs) = @_;
550550
local $/ = $rs;
551551
my $rec = <$fh>;
552-
chomp $rec if defined $rs;
552+
chomp $rec if defined $rec;
553553
$rec;
554554
}
555555

0 commit comments

Comments
 (0)