git-svn: avoid uninitialized value warning
This issue has been present since 2.11.0, but only became visible with the addition of the 'use warnings' pragma in 2.17.0.
This commit is contained in:
parent
5eb603d7e0
commit
e72bed93ca
49
0001-git-svn-avoid-warning-on-undef-readline.patch
Normal file
49
0001-git-svn-avoid-warning-on-undef-readline.patch
Normal file
@ -0,0 +1,49 @@
|
||||
From 51db2715876580acdb28b17079c9f6cb784da849 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?=
|
||||
<avarab@gmail.com>
|
||||
Date: Fri, 6 Apr 2018 13:15:14 +0000
|
||||
Subject: [PATCH] git-svn: avoid warning on undef readline()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
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>
|
||||
---
|
||||
perl/Git.pm | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/perl/Git.pm b/perl/Git.pm
|
||||
index d2c5a8d238b87..d453e4b83b827 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;
|
||||
}
|
||||
|
5
git.spec
5
git.spec
@ -116,6 +116,8 @@ Source99: print-failed-test-output
|
||||
Patch0: git-1.8-gitweb-home-link.patch
|
||||
# https://bugzilla.redhat.com/490602
|
||||
Patch1: git-cvsimport-Ignore-cvsps-2.2b1-Branches-output.patch
|
||||
# https://github.com/gitster/git/commit/51db271.patch
|
||||
Patch2: 0001-git-svn-avoid-warning-on-undef-readline.patch
|
||||
|
||||
%if %{with docs}
|
||||
BuildRequires: asciidoc >= 8.4.1
|
||||
@ -889,6 +891,9 @@ make test || ./print-failed-test-output
|
||||
%{?with_docs:%{_pkgdocdir}/git-svn.html}
|
||||
|
||||
%changelog
|
||||
* Mon Apr 09 2018 Todd Zullinger <tmz@pobox.com>
|
||||
- git-svn: avoid uninitialized value warning
|
||||
|
||||
* Sun Apr 08 2018 Todd Zullinger <tmz@pobox.com>
|
||||
- Clean up redundant and unneeded Requires
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user