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

Re: [PATCH 1/3] credential: add new interactive config option

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 20, 2024, 22:07 UTC
Message-ID
<xmqq7cb6dln7.fsf@gitster.g>
In-Reply-To
<1e9bf2d09c17bc0cdcd0a8f8dbacab007e5c53e7.1726790424.git.gitgitgadget@gmail.com>
"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 10 quoted lines
> @@ -501,8 +525,8 @@ void credential_fill(struct credential *c, int all_capabilities)
>  			    c->helpers.items[i].string);
>  	}
>  
> -	credential_getpass(c);
> -	if (!c->username && !c->password && !c->credential)
> +	if (credential_getpass(c) ||
> +	    (!c->username && !c->password && !c->credential))
>  		die("unable to get password from user");
>  }

This is a fallback mode after credential helpers have failed to fill and return. Unless these helpers pay attention to the "interactive" configuration, they may still get stuck. So it would be #leftoverbits to update each credential helpers to do the right thing.

The sample credential-store backend does not have to be updated I guess ;-)

Show 33 quoted lines
> diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh
> index 7b5ab0eae16..ceb3336a5c4 100755
> --- a/t/t5551-http-fetch-smart.sh
> +++ b/t/t5551-http-fetch-smart.sh
> @@ -186,6 +186,28 @@ test_expect_success 'clone from password-protected repository' '
>  	test_cmp expect actual
>  '
>  
> +test_expect_success 'credential.interactive=false skips askpass' '
> +	set_askpass bogus nonsense &&
> +	(
> +		GIT_TRACE2_EVENT="$(pwd)/interactive-true" &&
> +		export GIT_TRACE2_EVENT &&
> +		test_must_fail git clone --bare "$HTTPD_URL/auth/smart/repo.git" interactive-true-dir &&
> +		test_region credential interactive interactive-true &&
> +
> +		GIT_TRACE2_EVENT="$(pwd)/interactive-false" &&
> +		export GIT_TRACE2_EVENT &&
> +		test_must_fail git -c credential.interactive=false \
> +			clone --bare "$HTTPD_URL/auth/smart/repo.git" interactive-false-dir &&
> +		test_region ! credential interactive interactive-false &&
> +
> +		GIT_TRACE2_EVENT="$(pwd)/interactive-never" &&
> +		export GIT_TRACE2_EVENT &&
> +		test_must_fail git -c credential.interactive=never \
> +			clone --bare "$HTTPD_URL/auth/smart/repo.git" interactive-never-dir &&
> +		test_region ! credential interactive interactive-never
> +	)
> +'
> +
>  test_expect_success 'clone from auth-only-for-push repository' '
>  	echo two >expect &&
>  	set_askpass wrong &&
Previous: Derrick Stolee via GitGitGadgetNext: Derrick Stolee via GitGitGadget
Message 3 of 8 in “maintenance: configure credentials to be silent”
  1. 0/3 maintenance: configure credentials to be silentDerrick Stolee via GitGitGadget, Sep 20, 2024
  2. 1/3 credential: add new interactive config optionDerrick Stolee via GitGitGadget, Sep 20, 2024
  3. Junio C HamanoSep 20, 2024
  4. 2/3 maintenance: add custom config to background jobsDerrick Stolee via GitGitGadget, Sep 20, 2024
  5. 3/3 scalar: configure maintenance during 'reconfigure'Derrick Stolee via GitGitGadget, Sep 20, 2024
  6. Junio C HamanoSep 20, 2024
  7. Derrick StoleeSep 23, 2024
  8. Junio C HamanoSep 23, 2024

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.