{"thread":{"id":"52468","subject":"[PATCH 0/2] contrib/credential/netrc: Makefile + script cleanup","startedAt":"2019-12-16T21:31:59Z","lastAt":"2019-12-20T20:59:50Z","messageCount":9,"participants":["Denton Liu","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"388300","messageId":"cover.1576531851.git.liu.denton@gmail.com","threadId":"52468","inReplyTo":null,"subject":"[PATCH 0/2] contrib/credential/netrc: Makefile + script cleanup","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-12-16T21:32:32Z","receivedAt":"2019-12-16T21:31:59Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"I recently switched my workflow to use this credential helper and I\nnoticed a couple of problems:\n\n1. The interpreter path was hardcoded to #!/usr/bin/perl\n\n2. The script refuses to run outside of a Git repository\n\nThis patch series should fix these problems.\n\nDenton Liu (2):\n  contrib/credential/netrc: make PERL_PATH configurable\n  contrib/credential/netrc: work outside a repo\n\n contrib/credential/netrc/.gitignore           |  1 +\n contrib/credential/netrc/Makefile             | 26 +++++++++++++++++--\n ...ential-netrc => git-credential-netrc.perl} |  2 +-\n 3 files changed, 26 insertions(+), 3 deletions(-)\n create mode 100644 contrib/credential/netrc/.gitignore\n rename contrib/credential/netrc/{git-credential-netrc => git-credential-netrc.perl} (99%)\n\n-- \n2.24.1.664.g198078bb5a\n\n"},{"id":"388301","messageId":"d22eb1f9e2431199f1b6bea2aefe8473284e966e.1576531851.git.liu.denton@gmail.com","threadId":"52468","inReplyTo":"cover.1576531851.git.liu.denton@gmail.com","subject":"[PATCH 2/2] contrib/credential/netrc: work outside a repo","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-12-16T21:32:34Z","receivedAt":"2019-12-16T21:32:00Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Currently, git-credential-netrc does not work outside of a git\nrepository. It fails with the following error:\n\n\tfatal: Not a git repository: . at /usr/share/perl5/Git.pm line 214.\n\nThere is no real reason why need to be within a repository, though.\nCredential helpers should be able to work just fine outside the\nrepository as well.\n\nCall the non-self version of config() so that git-credential-netrc no\nlonger needs to be run within a repository.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n contrib/credential/netrc/git-credential-netrc.perl | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/credential/netrc/git-credential-netrc.perl b/contrib/credential/netrc/git-credential-netrc.perl\nindex ebfc123ec6..bc57cc6588 100755\n--- a/contrib/credential/netrc/git-credential-netrc.perl\n+++ b/contrib/credential/netrc/git-credential-netrc.perl\n@@ -423,7 +423,7 @@ sub load_config {\n \t# load settings from git config\n \tmy $options = shift;\n \t# set from command argument, gpg.program option, or default to gpg\n-\t$options->{'gpg'} //= Git->repository()->config('gpg.program')\n+\t$options->{'gpg'} //= Git::config('gpg.program')\n \t                  // 'gpg';\n \tlog_verbose(\"using $options{'gpg'} for GPG operations\");\n }\n-- \n2.24.1.664.g198078bb5a\n\n"},{"id":"388302","messageId":"fb01e34ec1c19dfac353f85e0f1b8162f1ca2434.1576531851.git.liu.denton@gmail.com","threadId":"52468","inReplyTo":"cover.1576531851.git.liu.denton@gmail.com","subject":"[PATCH 1/2] contrib/credential/netrc: make PERL_PATH configurable","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-12-16T21:32:33Z","receivedAt":"2019-12-16T21:32:01Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The shebang path for the Perl interpreter in git-credential-netrc was\nhardcoded. However, some users may have it located at a different\nlocation and thus, would have had to manually edit the script.\n\nAdd a .perl prefix to the script to denote it as a template and ignore\nthe generated version. Augment the Makefile so that it generates\ngit-credential-netrc from git-credential-netrc.perl, just like other\nPerl scripts.\n\nThe Makefile recipes were shamelessly stolen from\ncontrib/mw-to-git/Makefile.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n contrib/credential/netrc/.gitignore           |  1 +\n contrib/credential/netrc/Makefile             | 26 +++++++++++++++++--\n ...ential-netrc => git-credential-netrc.perl} |  0\n 3 files changed, 25 insertions(+), 2 deletions(-)\n create mode 100644 contrib/credential/netrc/.gitignore\n rename contrib/credential/netrc/{git-credential-netrc => git-credential-netrc.perl} (100%)\n\ndiff --git a/contrib/credential/netrc/.gitignore b/contrib/credential/netrc/.gitignore\nnew file mode 100644\nindex 0000000000..d41cdde84b\n--- /dev/null\n+++ b/contrib/credential/netrc/.gitignore\n@@ -0,0 +1 @@\n+git-credential-netrc\ndiff --git a/contrib/credential/netrc/Makefile b/contrib/credential/netrc/Makefile\nindex 6174e3bb83..c284fb8ac4 100644\n--- a/contrib/credential/netrc/Makefile\n+++ b/contrib/credential/netrc/Makefile\n@@ -1,8 +1,30 @@\n # The default target of this Makefile is...\n all::\n \n-test:\n+SCRIPT_PERL = git-credential-netrc.perl\n+GIT_ROOT_DIR = ../../..\n+HERE = contrib/credential/netrc\n+\n+SCRIPT_PERL_FULL = $(patsubst %,$(HERE)/%,$(SCRIPT_PERL))\n+\n+all:: build\n+\n+build:\n+\t$(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=\"$(SCRIPT_PERL_FULL)\" \\\n+                build-perl-script\n+\n+install: build\n+\t$(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=\"$(SCRIPT_PERL_FULL)\" \\\n+                install-perl-script\n+\n+clean:\n+\t$(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=\"$(SCRIPT_PERL_FULL)\" \\\n+                clean-perl-script\n+\n+test: build\n \t./t-git-credential-netrc.sh\n \n-testverbose:\n+testverbose: build\n \t./t-git-credential-netrc.sh -d -v\n+\n+.PHONY: all build install clean test testverbose\ndiff --git a/contrib/credential/netrc/git-credential-netrc b/contrib/credential/netrc/git-credential-netrc.perl\nsimilarity index 100%\nrename from contrib/credential/netrc/git-credential-netrc\nrename to contrib/credential/netrc/git-credential-netrc.perl\n-- \n2.24.1.664.g198078bb5a\n\n"},{"id":"388323","messageId":"20191217024858.GA2734969@coredump.intra.peff.net","threadId":"52468","inReplyTo":"cover.1576531851.git.liu.denton@gmail.com","subject":"Re: [PATCH 0/2] contrib/credential/netrc: Makefile + script cleanup","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2019-12-17T02:48:58Z","receivedAt":"2019-12-17T02:49:01Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Dec 16, 2019 at 01:32:32PM -0800, Denton Liu wrote:\n\n> I recently switched my workflow to use this credential helper and I\n> noticed a couple of problems:\n> \n> 1. The interpreter path was hardcoded to #!/usr/bin/perl\n> \n> 2. The script refuses to run outside of a Git repository\n> \n> This patch series should fix these problems.\n\nBoth of these patches look good to me.\n\nIt does make me wonder if many people are using credential-netrc, given\nthese pretty obvious problems. You're certainly welcome to use it if it\nworks for you, but I am curious what made you pick it versus one of the\nother more advanced helpers.\n\nI assume you're using a gpg-encrypted netrc (if not, you should probably\njust use credential-store). For \"read-only\" password access, I find the\ncombination of pass[1] with config like this is a bit nicer:\n\n  [credential \"https://github.com\"]\n  username = peff\n  helper = \"!f() { test $1 = get && echo password=`pass github/oauth`; }; f\"\n\n-Peff\n\n[1] https://www.passwordstore.org/\n"},{"id":"388331","messageId":"20191217061723.GA507345@generichostname","threadId":"52468","inReplyTo":"20191217024858.GA2734969@coredump.intra.peff.net","subject":"Re: [PATCH 0/2] contrib/credential/netrc: Makefile + script cleanup","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-12-17T06:17:23Z","receivedAt":"2019-12-17T06:17:29Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Hi Peff,\n\nOn Mon, Dec 16, 2019 at 09:48:58PM -0500, Jeff King wrote:\n> On Mon, Dec 16, 2019 at 01:32:32PM -0800, Denton Liu wrote:\n> \n> > I recently switched my workflow to use this credential helper and I\n> > noticed a couple of problems:\n> > \n> > 1. The interpreter path was hardcoded to #!/usr/bin/perl\n> > \n> > 2. The script refuses to run outside of a Git repository\n> > \n> > This patch series should fix these problems.\n> \n> Both of these patches look good to me.\n\nThanks for reviewing :)\n\n> \n> It does make me wonder if many people are using credential-netrc, given\n> these pretty obvious problems. You're certainly welcome to use it if it\n> works for you, but I am curious what made you pick it versus one of the\n> other more advanced helpers.\n\nI wanted a credential helper that was encrypted and OS-independent.\nSince GPG is basically available on everything, it fits my use case.\n\nIt also helped that it resulted in a workflow that was very similar to\nmy old mutt workflow. Before, I had\n\n\tsource \"gpg -dq ~/.mutt/credentials.gpg |\"\n\nand I just replaced the gpg with a script that wraps around git-credential.\n\n> \n> I assume you're using a gpg-encrypted netrc (if not, you should probably\n> just use credential-store). For \"read-only\" password access, I find the\n> combination of pass[1] with config like this is a bit nicer:\n\nNice, I never knew heard about pass until now. I only have one password\nin my credential store currently but if I need to add more, I'll keep\nthis in mind!\n\n-Denton\n\n> \n>   [credential \"https://github.com\"]\n>   username = peff\n>   helper = \"!f() { test $1 = get && echo password=`pass github/oauth`; }; f\"\n> \n> -Peff\n> \n> [1] https://www.passwordstore.org/\n"},{"id":"388658","messageId":"cover.1576867467.git.liu.denton@gmail.com","threadId":"52468","inReplyTo":"cover.1576531851.git.liu.denton@gmail.com","subject":"[RESEND PATCH 0/2] contrib/credential/netrc: Makefile + script cleanup","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-12-20T18:44:59Z","receivedAt":"2019-12-20T18:43:25Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"I recently switched my workflow to use this credential helper and I\nnoticed a couple of problems:\n\n1. The interpreter path was hardcoded to #!/usr/bin/perl\n\n2. The script refuses to run outside of a Git repository\n\nThis patch series should fix these problems.\n\nDenton Liu (2):\n  contrib/credential/netrc: make PERL_PATH configurable\n  contrib/credential/netrc: work outside a repo\n\n contrib/credential/netrc/.gitignore           |  1 +\n contrib/credential/netrc/Makefile             | 26 +++++++++++++++++--\n ...ential-netrc => git-credential-netrc.perl} |  2 +-\n 3 files changed, 26 insertions(+), 3 deletions(-)\n create mode 100644 contrib/credential/netrc/.gitignore\n rename contrib/credential/netrc/{git-credential-netrc => git-credential-netrc.perl} (99%)\n\n-- \n2.24.1.703.g2f499f1283\n\n"},{"id":"388659","messageId":"fb01e34ec1c19dfac353f85e0f1b8162f1ca2434.1576867467.git.liu.denton@gmail.com","threadId":"52468","inReplyTo":"cover.1576867467.git.liu.denton@gmail.com","subject":"[RESEND PATCH 1/2] contrib/credential/netrc: make PERL_PATH configurable","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-12-20T18:45:00Z","receivedAt":"2019-12-20T18:43:28Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"The shebang path for the Perl interpreter in git-credential-netrc was\nhardcoded. However, some users may have it located at a different\nlocation and thus, would have had to manually edit the script.\n\nAdd a .perl prefix to the script to denote it as a template and ignore\nthe generated version. Augment the Makefile so that it generates\ngit-credential-netrc from git-credential-netrc.perl, just like other\nPerl scripts.\n\nThe Makefile recipes were shamelessly stolen from\ncontrib/mw-to-git/Makefile.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n contrib/credential/netrc/.gitignore           |  1 +\n contrib/credential/netrc/Makefile             | 26 +++++++++++++++++--\n ...ential-netrc => git-credential-netrc.perl} |  0\n 3 files changed, 25 insertions(+), 2 deletions(-)\n create mode 100644 contrib/credential/netrc/.gitignore\n rename contrib/credential/netrc/{git-credential-netrc => git-credential-netrc.perl} (100%)\n\ndiff --git a/contrib/credential/netrc/.gitignore b/contrib/credential/netrc/.gitignore\nnew file mode 100644\nindex 0000000000..d41cdde84b\n--- /dev/null\n+++ b/contrib/credential/netrc/.gitignore\n@@ -0,0 +1 @@\n+git-credential-netrc\ndiff --git a/contrib/credential/netrc/Makefile b/contrib/credential/netrc/Makefile\nindex 6174e3bb83..c284fb8ac4 100644\n--- a/contrib/credential/netrc/Makefile\n+++ b/contrib/credential/netrc/Makefile\n@@ -1,8 +1,30 @@\n # The default target of this Makefile is...\n all::\n \n-test:\n+SCRIPT_PERL = git-credential-netrc.perl\n+GIT_ROOT_DIR = ../../..\n+HERE = contrib/credential/netrc\n+\n+SCRIPT_PERL_FULL = $(patsubst %,$(HERE)/%,$(SCRIPT_PERL))\n+\n+all:: build\n+\n+build:\n+\t$(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=\"$(SCRIPT_PERL_FULL)\" \\\n+                build-perl-script\n+\n+install: build\n+\t$(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=\"$(SCRIPT_PERL_FULL)\" \\\n+                install-perl-script\n+\n+clean:\n+\t$(MAKE) -C $(GIT_ROOT_DIR) SCRIPT_PERL=\"$(SCRIPT_PERL_FULL)\" \\\n+                clean-perl-script\n+\n+test: build\n \t./t-git-credential-netrc.sh\n \n-testverbose:\n+testverbose: build\n \t./t-git-credential-netrc.sh -d -v\n+\n+.PHONY: all build install clean test testverbose\ndiff --git a/contrib/credential/netrc/git-credential-netrc b/contrib/credential/netrc/git-credential-netrc.perl\nsimilarity index 100%\nrename from contrib/credential/netrc/git-credential-netrc\nrename to contrib/credential/netrc/git-credential-netrc.perl\n-- \n2.24.1.703.g2f499f1283\n\n"},{"id":"388660","messageId":"d22eb1f9e2431199f1b6bea2aefe8473284e966e.1576867467.git.liu.denton@gmail.com","threadId":"52468","inReplyTo":"cover.1576867467.git.liu.denton@gmail.com","subject":"[RESEND PATCH 2/2] contrib/credential/netrc: work outside a repo","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-12-20T18:45:01Z","receivedAt":"2019-12-20T18:43:28Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Currently, git-credential-netrc does not work outside of a git\nrepository. It fails with the following error:\n\n\tfatal: Not a git repository: . at /usr/share/perl5/Git.pm line 214.\n\nThere is no real reason why need to be within a repository, though.\nCredential helpers should be able to work just fine outside the\nrepository as well.\n\nCall the non-self version of config() so that git-credential-netrc no\nlonger needs to be run within a repository.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n contrib/credential/netrc/git-credential-netrc.perl | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/credential/netrc/git-credential-netrc.perl b/contrib/credential/netrc/git-credential-netrc.perl\nindex ebfc123ec6..bc57cc6588 100755\n--- a/contrib/credential/netrc/git-credential-netrc.perl\n+++ b/contrib/credential/netrc/git-credential-netrc.perl\n@@ -423,7 +423,7 @@ sub load_config {\n \t# load settings from git config\n \tmy $options = shift;\n \t# set from command argument, gpg.program option, or default to gpg\n-\t$options->{'gpg'} //= Git->repository()->config('gpg.program')\n+\t$options->{'gpg'} //= Git::config('gpg.program')\n \t                  // 'gpg';\n \tlog_verbose(\"using $options{'gpg'} for GPG operations\");\n }\n-- \n2.24.1.703.g2f499f1283\n\n"},{"id":"388674","messageId":"20191220205947.GA2752079@coredump.intra.peff.net","threadId":"52468","inReplyTo":"cover.1576867467.git.liu.denton@gmail.com","subject":"Re: [RESEND PATCH 0/2] contrib/credential/netrc: Makefile + script cleanup","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2019-12-20T20:59:47Z","receivedAt":"2019-12-20T20:59:50Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Dec 20, 2019 at 10:44:59AM -0800, Denton Liu wrote:\n\n> I recently switched my workflow to use this credential helper and I\n> noticed a couple of problems:\n> \n> 1. The interpreter path was hardcoded to #!/usr/bin/perl\n> \n> 2. The script refuses to run outside of a Git repository\n> \n> This patch series should fix these problems.\n\nSince this is just a re-send, I'll re-send my:\n\n  Reviewed-by: Jeff King <peff@peff.net>\n\n:)\n\n-Peff\n"}]}