]> git.ipfire.org Git - thirdparty/git.git/commitdiff
contrib/credential/netrc: work outside a repo
authorDenton Liu <liu.denton@gmail.com>
Fri, 20 Dec 2019 18:45:01 +0000 (10:45 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 20 Dec 2019 20:40:52 +0000 (12:40 -0800)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/credential/netrc/git-credential-netrc.perl

index ebfc123ec641ddfa1bb2aaa83dab268c19083b2a..bc57cc65884b97dc6a0d33a067f00dac35ee19a8 100755 (executable)
@@ -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");
 }