Re: [PATCH] Add contrib/credentials/netrc with GPG support, try #2

2013-02-05 Thread Ted Zlatanov
On Tue, 05 Feb 2013 12:23:00 -0800 Junio C Hamano wrote: JCH> Ted Zlatanov writes: JCH> You still need to parse a file that has a "default" entry correctly; JCH> otherwise the users won't be able to share existing .netrc files JCH> with other applications e.g. ftp, which is the whole point of t

Re: [PATCH] Add contrib/credentials/netrc with GPG support, try #2

2013-02-05 Thread Junio C Hamano
Ted Zlatanov writes: > JCH> You still need to parse a file that has a "default" entry correctly; > JCH> otherwise the users won't be able to share existing .netrc files > JCH> with other applications e.g. ftp, which is the whole point of this > JCH> series. Not using values from the "default" en

Re: [PATCH] Add contrib/credentials/netrc with GPG support, try #2

2013-02-05 Thread Ted Zlatanov
On Tue, 05 Feb 2013 11:47:56 -0800 Junio C Hamano wrote: JCH> Ted Zlatanov writes: JCH> Oh, another thing. 'default' is like 'machine' followed by any JCH> machine name, so the above while loop that reads two tokens JCH> pair-wise needs to be aware that 'default' is not followed by a JCH> value

Re: [PATCH] Add contrib/credentials/netrc with GPG support, try #2

2013-02-05 Thread Junio C Hamano
Ted Zlatanov writes: > JCH> Oh, another thing. 'default' is like 'machine' followed by any > JCH> machine name, so the above while loop that reads two tokens > JCH> pair-wise needs to be aware that 'default' is not followed by a > JCH> value. I think the loop will fail to parse this: > > JCH>

Re: [PATCH] Add contrib/credentials/netrc with GPG support, try #2

2013-02-05 Thread Ted Zlatanov
On Tue, 05 Feb 2013 08:15:48 -0800 Junio C Hamano wrote: JCH> Ted Zlatanov writes: >> +# build reverse token map >> +my %rmap; >> +foreach my $k (keys %{$options{tmap}}) { >> +push @{$rmap{$options{tmap}->{$k}}}, $k; >> +} JCH> Mental note: "$rmap{foo} -eq 'bar'" means that what Git calls

Re: [PATCH] Add contrib/credentials/netrc with GPG support, try #2

2013-02-05 Thread Junio C Hamano
Junio C Hamano writes: > I thought I've given a more concrete outline than "I'll read > Net::Netrc and do whatever I think it does" in a separate message. And it turns out that the message was sitting in my outbox. Sorry. I just told the outbox to send it out. -- To unsubscribe from this list:

Re: [PATCH] Add contrib/credentials/netrc with GPG support, try #2

2013-02-05 Thread Junio C Hamano
Ted Zlatanov writes: > +# build reverse token map > +my %rmap; > +foreach my $k (keys %{$options{tmap}}) { > + push @{$rmap{$options{tmap}->{$k}}}, $k; > +} Mental note: "$rmap{foo} -eq 'bar'" means that what Git calls 'bar' is found as 'foo' in the netrc/authinfo file. Keys in %rmap are wh

Re: [PATCH] Add contrib/credentials/netrc with GPG support, try #2

2013-02-05 Thread Junio C Hamano
Ted Zlatanov writes: > On Mon, 04 Feb 2013 16:15:47 -0800 Junio C Hamano wrote: > > JCH> Ted Zlatanov writes: > >>> - do you want to support backslashed newlines? > > JCH> What for? netrc/authinfo is not a line oriented file format at all, > JCH> and > > JCH> machine k.org > JCH>

Re: [PATCH] Add contrib/credentials/netrc with GPG support, try #2

2013-02-05 Thread Ted Zlatanov
On Mon, 04 Feb 2013 16:15:47 -0800 Junio C Hamano wrote: JCH> Ted Zlatanov writes: >> - do you want to support backslashed newlines? JCH> What for? netrc/authinfo is not a line oriented file format at all, JCH> and JCH>machine k.org JCH>login me JCH>

Re: [PATCH] Add contrib/credentials/netrc with GPG support, try #2

2013-02-04 Thread Junio C Hamano
Ted Zlatanov writes: > On Mon, 04 Feb 2013 15:40:32 -0800 Junio C Hamano wrote: > > JCH> "Sorry we couldn't" sounded like an error messag to me. If this is > JCH> a normal exit, then please make sure it is a normal exit. > > OK; done in PATCHv4: removed all "Sorry" because they are not abnorma

Re: [PATCH] Add contrib/credentials/netrc with GPG support, try #2

2013-02-04 Thread Ted Zlatanov
On Mon, 04 Feb 2013 15:40:32 -0800 Junio C Hamano wrote: JCH> "Sorry we couldn't" sounded like an error messag to me. If this is JCH> a normal exit, then please make sure it is a normal exit. OK; done in PATCHv4: removed all "Sorry" because they are not abnormal exits. I'll hold PATCHv4 until

Re: [PATCH] Add contrib/credentials/netrc with GPG support, try #2

2013-02-04 Thread Ted Zlatanov
On Mon, 4 Feb 2013 18:23:17 -0500 Jeff King wrote: >> Perhaps "-r $file", if you say "is not accessible"? JK> Even better: look at whether opening the file was successful. Though I JK> guess that is complicated by the use of gpg, who will probably not JK> distinguish ENOENT from other failures

Re: [PATCH] Add contrib/credentials/netrc with GPG support, try #2

2013-02-04 Thread Junio C Hamano
Ted Zlatanov writes: >>> +my $mode = shift @ARGV; >>> + >>> +# credentials may get 'get', 'store', or 'erase' as parameters but >>> +# only acknowledge 'get' >>> +die "Syntax: $0 [-f AUTHFILE] [-d] get" unless defined $mode; >>> + >>> +# only support 'get' mode >>> +exit unless $mode eq 'get'; >

Re: [PATCH] Add contrib/credentials/netrc with GPG support, try #2

2013-02-04 Thread Junio C Hamano
Jeff King writes: > On Mon, Feb 04, 2013 at 02:56:06PM -0800, Junio C Hamano wrote: > >> > +my $mode = shift @ARGV; >> > + >> > +# credentials may get 'get', 'store', or 'erase' as parameters but >> > +# only acknowledge 'get' >> > +die "Syntax: $0 [-f AUTHFILE] [-d] get" unless defined $mode; >>

Re: [PATCH] Add contrib/credentials/netrc with GPG support, try #2

2013-02-04 Thread Ted Zlatanov
On Mon, 04 Feb 2013 14:56:06 -0800 Junio C Hamano wrote: JCH> I recall that netrc/authinfo files are _not_ line oriented. Earlier JCH> you said "looks for entries that match" which is a lot more correct, JCH> but then we see "look for lines in authfile". Hmm, do you mean backslashed newlines?

Re: [PATCH] Add contrib/credentials/netrc with GPG support, try #2

2013-02-04 Thread Jeff King
On Mon, Feb 04, 2013 at 02:56:06PM -0800, Junio C Hamano wrote: > > +my $mode = shift @ARGV; > > + > > +# credentials may get 'get', 'store', or 'erase' as parameters but > > +# only acknowledge 'get' > > +die "Syntax: $0 [-f AUTHFILE] [-d] get" unless defined $mode; > > + > > +# only support 'get

Re: [PATCH] Add contrib/credentials/netrc with GPG support, try #2

2013-02-04 Thread Junio C Hamano
Ted Zlatanov writes: > Signed-off-by: Ted Zlatanov The space above your S-o-b: could be utilized a bit better ;-) > @@ -0,0 +1,236 @@ > +#!/usr/bin/perl > + > +use strict; > +use warnings; > + > +use Getopt::Long; > +use File::Basename; > + > +my $VERSION = "0.1"; > + > +my %options = ( > +

[PATCH] Add contrib/credentials/netrc with GPG support, try #2

2013-02-04 Thread Ted Zlatanov
Signed-off-by: Ted Zlatanov --- contrib/credential/netrc/git-credential-netrc | 236 + 1 files changed, 236 insertions(+), 0 deletions(-) create mode 100755 contrib/credential/netrc/git-credential-netrc diff --git a/contrib/credential/netrc/git-credential-netrc b/con

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

2013-02-04 Thread Ted Zlatanov
On Mon, 4 Feb 2013 16:17:26 -0500 Jeff King wrote: JK> Do you need to quote "\n" here? Fixed. JK> Hmm, so it's not an error (just a warning) to say: JK> git credential-netrc -f /does/not/exist JK> but it is an error to say: JK> git credential-netrc JK> and have it fail to find any netr

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

2013-02-04 Thread Jeff King
On Mon, Feb 04, 2013 at 02:54:30PM -0500, Ted Zlatanov wrote: > + print < + > +$0 [-f AUTHFILE] [-d] get > + > +Version $VERSION by tzz\@lifelogs.com. License: BSD. This here-doc is interpolated so you can use $0 and $VERSION, and therefore have to quote the @-sign. But later in the here-doc

[PATCH] Add contrib/credentials/netrc with GPG support

2013-02-04 Thread Ted Zlatanov
Signed-off-by: Ted Zlatanov --- contrib/credential/netrc/git-credential-netrc | 223 + 1 files changed, 223 insertions(+), 0 deletions(-) create mode 100755 contrib/credential/netrc/git-credential-netrc diff --git a/contrib/credential/netrc/git-credential-netrc b/cont