Subject: Re: [PATCHv4] Add contrib/credentials/netrc with GPG support

From: Ted Zlatanov <[email-masked]>
Date: Tue, 05 Feb 2013 17:30:12 -0500

On Tue, 05 Feb 2013 14:09:58 -0800 Junio C Hamano <[email-masked]> wrote: 

JCH> open $io, "-|", qw(gpg --decrypt), $ARGV[0]

OK, the below will be in PATCHv6 (I'll wait on mailing it until after
you've reviewed the rest of PATCHv5).  Thanks for checking... I must
have had a typo or a missing comma or something, I could swear I tried
exactly what you show.

Ted

diff --git a/contrib/credential/netrc/git-credential-netrc b/contrib/credential/netrc/git-credential-netrc
index 8298564..5f91630 100755
--- a/contrib/credential/netrc/git-credential-netrc
+++ b/contrib/credential/netrc/git-credential-netrc
@@ -230,13 +230,9 @@ sub load_netrc {
 
 	my $io;
 	if ($gpgmode) {
-		# typical shell character escapes from http://www.slac.stanford.edu/slac/www/resource/how-to-use/cgi-rexx/cgi-esc.html
-		my $f = $file;
-		$f =~ s/([;<>\*\|`&\$!#\(\)\[\]\{\}:'"])/\\$1/g;
-		# GPG doesn't work well with 2- or 3-argument open
-		my $cmd = "gpg --decrypt $f";
-		log_verbose("Using GPG to open $file: [$cmd]");
-		open $io, "$cmd|";
+		my @cmd = (qw(gpg --decrypt), $file);
+		log_verbose("Using GPG to open $file: [@cmd]");
+		open $io, "-|", @cmd;
 	}
 	else {
 		log_verbose("Opening $file...");