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 &&