git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Denton Liu <liu.denton@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: Luis Marsano <luis.marsano@gmail.com>, Ted Zlatanov <tzz@lifelogs.com>
Subject: [PATCH 2/2] contrib/credential/netrc: work outside a repo
Date: Mon, 16 Dec 2019 13:32:34 -0800	[thread overview]
Message-ID: <d22eb1f9e2431199f1b6bea2aefe8473284e966e.1576531851.git.liu.denton@gmail.com> (raw)
In-Reply-To: <cover.1576531851.git.liu.denton@gmail.com>

Currently, git-credential-netrc does not work outside of a git
repository. It fails with the following error:

	fatal: Not a git repository: . at /usr/share/perl5/Git.pm line 214.

There is no real reason why need to be within a repository, though.
Credential helpers should be able to work just fine outside the
repository as well.

Call the non-self version of config() so that git-credential-netrc no
longer needs to be run within a repository.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
---
 contrib/credential/netrc/git-credential-netrc.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/credential/netrc/git-credential-netrc.perl b/contrib/credential/netrc/git-credential-netrc.perl
index ebfc123ec6..bc57cc6588 100755
--- a/contrib/credential/netrc/git-credential-netrc.perl
+++ b/contrib/credential/netrc/git-credential-netrc.perl
@@ -423,7 +423,7 @@ sub load_config {
 	# load settings from git config
 	my $options = shift;
 	# set from command argument, gpg.program option, or default to gpg
-	$options->{'gpg'} //= Git->repository()->config('gpg.program')
+	$options->{'gpg'} //= Git::config('gpg.program')
 	                  // 'gpg';
 	log_verbose("using $options{'gpg'} for GPG operations");
 }
-- 
2.24.1.664.g198078bb5a


  parent reply	other threads:[~2019-12-16 21:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-16 21:32 [PATCH 0/2] contrib/credential/netrc: Makefile + script cleanup Denton Liu
2019-12-16 21:32 ` [PATCH 1/2] contrib/credential/netrc: make PERL_PATH configurable Denton Liu
2019-12-16 21:32 ` Denton Liu [this message]
2019-12-17  2:48 ` [PATCH 0/2] contrib/credential/netrc: Makefile + script cleanup Jeff King
2019-12-17  6:17   ` Denton Liu
2019-12-20 18:44 ` [RESEND PATCH " Denton Liu
2019-12-20 18:45   ` [RESEND PATCH 1/2] contrib/credential/netrc: make PERL_PATH configurable Denton Liu
2019-12-20 18:45   ` [RESEND PATCH 2/2] contrib/credential/netrc: work outside a repo Denton Liu
2019-12-20 20:59   ` [RESEND PATCH 0/2] contrib/credential/netrc: Makefile + script cleanup Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d22eb1f9e2431199f1b6bea2aefe8473284e966e.1576531851.git.liu.denton@gmail.com \
    --to=liu.denton@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=luis.marsano@gmail.com \
    --cc=tzz@lifelogs.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).