summaryrefslogtreecommitdiff
path: root/perl
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2018-04-06 13:15:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-04-09 02:11:13 (GMT)
commit51db2715876580acdb28b17079c9f6cb784da849 (patch)
treef2f918fff3a25f38d36e2237342770b709a63b06 /perl
parentb26098fc2f76131f4258d800e0892e87f9138331 (diff)
downloadgit-51db2715876580acdb28b17079c9f6cb784da849.zip
git-51db2715876580acdb28b17079c9f6cb784da849.tar.gz
git-51db2715876580acdb28b17079c9f6cb784da849.tar.bz2
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 b26098fc2f ("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 f0e19cb7ce ("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 b26098fc2f ("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/86h8oobl36.fsf@phe.ftfl.ca/ for the original report. Reported-by: Joseph Mingrone <jrm@ftfl.ca> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Improved-by: Eric Wong <e@80x24.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'perl')
-rw-r--r--perl/Git.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/perl/Git.pm b/perl/Git.pm
index d2c5a8d..d453e4b 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -549,7 +549,7 @@ sub get_record {
my ($fh, $rs) = @_;
local $/ = $rs;
my $rec = <$fh>;
- chomp $rec if defined $rs;
+ chomp $rec if defined $rec;
$rec;
}