File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -598,8 +598,7 @@ static void init_curl_http_auth(CURL *result)
598598{
599599 if ((!http_auth .username || !* http_auth .username ) &&
600600 (!http_auth .credential || !* http_auth .credential )) {
601- int empty_auth = curl_empty_auth_enabled ();
602- if ((empty_auth != -1 && !always_auth_proactively ()) || empty_auth == 1 ) {
601+ if (!always_auth_proactively () && curl_empty_auth_enabled ()) {
603602 curl_easy_setopt (result , CURLOPT_USERPWD , ":" );
604603 return ;
605604 } else if (!always_auth_proactively ()) {
Original file line number Diff line number Diff line change @@ -201,4 +201,14 @@ test_expect_failure 'push to password-protected repository (no user in URL)' '
201201 test_cmp expect actual
202202'
203203
204+ test_expect_success ' push to password-protected repository (netrc)' '
205+ test_commit pw-netrc &&
206+ echo "default login user@host password pass@host" >"$HOME/.netrc" &&
207+ GIT_TRACE=1 GIT_CURL_VERBOSE=1 git push "$HTTPD_URL/auth/dumb/test_repo.git" HEAD &&
208+ git rev-parse --verify HEAD >expect &&
209+ git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/auth/dumb/test_repo.git" \
210+ rev-parse --verify HEAD >actual &&
211+ test_cmp expect actual
212+ '
213+
204214test_done
You can’t perform that action at this time.
0 commit comments