From: Stefan Naewe <stefan.naewe@gmail.com>
To: gitster@pobox.com, git@vger.kernel.org, peff@peff.net
Cc: Stefan Naewe <stefan.naewe@gmail.com>
Subject: [PATCH] http-push: don't always prompt for password
Date: Fri, 4 Nov 2011 08:03:08 +0100 [thread overview]
Message-ID: <1320390188-24334-1-git-send-email-stefan.naewe@gmail.com> (raw)
In-Reply-To: <7vfwi6jucg.fsf@alter.siamese.dyndns.org>
http-push prompts for a password when the URL is set as
'https://user@host/repo' even though there is one set
in ~/.netrc. Pressing ENTER at the password prompt succeeds
then, but is a annoying and makes it almost useless
in a shell script, e.g.
Signed-off-by: Stefan Naewe <stefan.naewe@gmail.com>
---
http.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/http.c b/http.c
index a4bc770..008ad72 100644
--- a/http.c
+++ b/http.c
@@ -279,8 +279,6 @@ static CURL *get_curl_handle(void)
curl_easy_setopt(result, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
#endif
- init_curl_http_auth(result);
-
if (ssl_cert != NULL)
curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert);
if (has_cert_password())
@@ -846,7 +844,7 @@ static int http_request(const char *url, void *result, int target, int options)
else if (missing_target(&results))
ret = HTTP_MISSING_TARGET;
else if (results.http_code == 401) {
- if (user_name) {
+ if (user_name && user_pass) {
ret = HTTP_NOAUTH;
} else {
/*
@@ -855,7 +853,8 @@ static int http_request(const char *url, void *result, int target, int options)
* but that is non-portable. Using git_getpass() can at least be stubbed
* on other platforms with a different implementation if/when necessary.
*/
- user_name = xstrdup(git_getpass_with_description("Username", description));
+ if (!user_name)
+ user_name = xstrdup(git_getpass_with_description("Username", description));
init_curl_http_auth(slot->curl);
ret = HTTP_REAUTH;
}
--
1.7.8.rc0.1.gb345ae
next prev parent reply other threads:[~2011-11-04 7:03 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-31 5:00 [ANNOUNCE] Git 1.7.8.rc0 Junio C Hamano
2011-10-31 14:17 ` Stefan Näwe
2011-10-31 17:19 ` Junio C Hamano
2011-11-01 9:53 ` Stefan Näwe
2011-11-01 18:12 ` Junio C Hamano
2011-11-01 18:19 ` Jeff King
2011-11-01 20:06 ` Stefan Naewe
2011-11-01 20:18 ` Stefan Naewe
2011-11-02 10:27 ` Michael J Gruber
2011-11-02 18:03 ` Jeff King
2011-11-02 18:10 ` Jeff King
2011-11-02 19:13 ` Junio C Hamano
2011-11-02 20:09 ` Jeff King
2011-11-03 23:02 ` Junio C Hamano
2011-11-01 21:53 ` Stefan Naewe
2011-11-02 8:52 ` [RFC/PATCH] http-push: don't always prompt for password (Was Re: [ANNOUNCE] Git 1.7.8.rc0) Stefan Näwe
2011-11-02 14:08 ` Michael J Gruber
2011-11-02 17:13 ` [RFC/PATCH] http-push: don't always prompt for password Junio C Hamano
2011-11-02 17:23 ` Jeff King
2011-11-02 17:40 ` Junio C Hamano
2011-11-04 7:03 ` Stefan Naewe [this message]
2011-11-04 16:48 ` [PATCH] " Junio C Hamano
2011-11-04 17:43 ` Jeff King
2011-11-04 19:06 ` Junio C Hamano
2011-11-04 18:34 ` Stefan Naewe
2011-11-05 6:45 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1320390188-24334-1-git-send-email-stefan.naewe@gmail.com \
--to=stefan.naewe@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).