summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2018-06-13 07:48:10 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-06-13 16:49:50 (GMT)
commit627be1538ddcce8f5072b892ce415006034f371f (patch)
tree9e17db5e8ada6f66c3fc9faf45a8e3b8aa276d56
parent786ef50a23cbd0e93d1e41982cfaba76801ed885 (diff)
downloadgit-627be1538ddcce8f5072b892ce415006034f371f.zip
git-627be1538ddcce8f5072b892ce415006034f371f.tar.gz
git-627be1538ddcce8f5072b892ce415006034f371f.tar.bz2
git-credential-netrc: remove use of "autodie"
The "autodie" module was added in Perl 5.10.1, but our INSTALL document says "version 5.8 or later is needed". As discussed in <87efhfvxzu.fsf@evledraar.gmail.com> this script is in contrib/, so we might not want to apply that policy, however in this case "autodie" was recently added as a "gratuitous safeguard" in 786ef50a23 ("git-credential-netrc: accept gpg option", 2018-05-12) (see <CAHqJXRE8OKSKcck1APHAHccLZhox+tZi8nNu2RA74RErX8s3Pg@mail.gmail.com>). Looking at it more carefully the addition of "autodie" inadvertently introduced a logic error, since having it is equivalent to this patch: @@ -245,10 +244,10 @@ sub load_netrc { if ($gpgmode) { my @cmd = ($options{'gpg'}, qw(--decrypt), $file); log_verbose("Using GPG to open $file: [@cmd]"); - open $io, "-|", @cmd; + open $io, "-|", @cmd or die "@cmd: $!"; } else { log_verbose("Opening $file..."); - open $io, '<', $file; + open $io, '<', $file or die "$file: $!$!; } # nothing to do if the open failed (we log the error later) As shown in the context the intent of that code is not do die but to log the error later. Per my reading of the file this was the only thing autodie was doing in this file (there was no other code it altered). So let's remove it, both to fix the logic error and to get rid of the dependency. 1. <87efhfvxzu.fsf@evledraar.gmail.com> (https://public-inbox.org/git/87efhfvxzu.fsf@evledraar.gmail.com/) 2. <CAHqJXRE8OKSKcck1APHAHccLZhox+tZi8nNu2RA74RErX8s3Pg@mail.gmail.com> (https://public-inbox.org/git/CAHqJXRE8OKSKcck1APHAHccLZhox+tZi8nNu2RA74RErX8s3Pg@mail.gmail.com/) Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xcontrib/credential/netrc/git-credential-netrc1
1 files changed, 0 insertions, 1 deletions
diff --git a/contrib/credential/netrc/git-credential-netrc b/contrib/credential/netrc/git-credential-netrc
index 0b9a941..ebfc123 100755
--- a/contrib/credential/netrc/git-credential-netrc
+++ b/contrib/credential/netrc/git-credential-netrc
@@ -2,7 +2,6 @@
use strict;
use warnings;
-use autodie;
use Getopt::Long;
use File::Basename;