git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] credential: load default config

From
Jeff King <peff@peff.net>
Date
Oct 16, 2020, 01:04 UTC
Message-ID
<20201016010423.GD2932796@coredump.intra.peff.net>
In-Reply-To
<pull.881.git.git.1602799160623.gitgitgadget@gmail.com>
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
Previous: Thomas Koutcher via GitGitGadgetNext: Thomas Koutcher
Message 2 of 3 in “credential: load default config”
  1. credential: load default configThomas Koutcher via GitGitGadget, Oct 15, 2020
  2. Jeff KingOct 16, 2020
  3. Thomas KoutcherOct 16, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.