git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] credential: load default config
@ 2020-10-15 21:59 Thomas Koutcher via GitGitGadget
  2020-10-16  1:04 ` Jeff King
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Koutcher via GitGitGadget @ 2020-10-15 21:59 UTC (permalink / raw)
  To: git; +Cc: Thomas Koutcher, Thomas Koutcher

From: Thomas Koutcher <thomas.koutcher@online.fr>

Make `git credential fill` honour the core.askPass variable.

Signed-off-by: Thomas Koutcher <thomas.koutcher@online.fr>
---
    credential: load default config
    
    Make git credential fill honour the core.askPass variable.
    
    Signed-off-by: Thomas Koutcher thomas.koutcher@online.fr
    [thomas.koutcher@online.fr]

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-881%2Fkoutcher%2Fmaint-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-881/koutcher/maint-v1
Pull-Request: https://github.com/git/git/pull/881

 builtin/credential.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/builtin/credential.c b/builtin/credential.c
index 879acfbcda..d75dcdc64a 100644
--- a/builtin/credential.c
+++ b/builtin/credential.c
@@ -1,6 +1,7 @@
 #include "git-compat-util.h"
 #include "credential.h"
 #include "builtin.h"
+#include "config.h"
 
 static const char usage_msg[] =
 	"git credential [fill|approve|reject]";
@@ -10,6 +11,8 @@ int cmd_credential(int argc, const char **argv, const char *prefix)
 	const char *op;
 	struct credential c = CREDENTIAL_INIT;
 
+	git_config(git_default_config, NULL);
+
 	if (argc != 2 || !strcmp(argv[1], "-h"))
 		usage(usage_msg);
 	op = argv[1];

base-commit: 47ae905ffb98cc4d4fd90083da6bc8dab55d9ecc
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] credential: load default config
  2020-10-15 21:59 [PATCH] credential: load default config Thomas Koutcher via GitGitGadget
@ 2020-10-16  1:04 ` Jeff King
  2020-10-16 20:39   ` Thomas Koutcher
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2020-10-16  1:04 UTC (permalink / raw)
  To: Thomas Koutcher via GitGitGadget; +Cc: git, Thomas Koutcher

On Thu, Oct 15, 2020 at 09:59:20PM +0000, Thomas Koutcher via GitGitGadget wrote:

> Make `git credential fill` honour the core.askPass variable.

Thanks, I agree this make sense to do.

>  builtin/credential.c | 3 +++
>  1 file changed, 3 insertions(+)

Perhaps it's worth squashing in this test?

diff --git a/t/t0300-credentials.sh b/t/t0300-credentials.sh
index bc2d74098f..a18f8a473b 100755
--- a/t/t0300-credentials.sh
+++ b/t/t0300-credentials.sh
@@ -265,6 +265,32 @@ test_expect_success 'internal getpass does not ask for known username' '
 	EOF
 '
 
+test_expect_success 'git-credential respects core.askPass' '
+	write_script alternate-askpass <<-\EOF &&
+	echo >&2 "alternate askpass invoked"
+	echo alternate-value
+	EOF
+	test_config core.askpass "$PWD/alternate-askpass" &&
+	(
+		# unset GIT_ASKPASS set by lib-credential.sh which would
+		# override our config, but do so in a subshell so that we do
+		# not interfere with other tests
+		sane_unset GIT_ASKPASS &&
+		check fill <<-\EOF
+		protocol=http
+		host=example.com
+		--
+		protocol=http
+		host=example.com
+		username=alternate-value
+		password=alternate-value
+		--
+		alternate askpass invoked
+		alternate askpass invoked
+		EOF
+	)
+'
+
 HELPER="!f() {
 		cat >/dev/null
 		echo username=foo

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] credential: load default config
  2020-10-16  1:04 ` Jeff King
@ 2020-10-16 20:39   ` Thomas Koutcher
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Koutcher @ 2020-10-16 20:39 UTC (permalink / raw)
  To: Jeff King, Thomas Koutcher via GitGitGadget; +Cc: git

Le 16/10/2020 à 03:04, Jeff King a écrit :

> Perhaps it's worth squashing in this test?

Definitely, thanks for adding the test, Peff !



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-16 20:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15 21:59 [PATCH] credential: load default config Thomas Koutcher via GitGitGadget
2020-10-16  1:04 ` Jeff King
2020-10-16 20:39   ` Thomas Koutcher

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).