summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmos King <amos.l.king@gmail.com>2009-03-18 23:46:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-03-19 10:28:18 (GMT)
commit44d808c238f0817fc3ae7caea8f3b625b6180e37 (patch)
tree7f2c7bda91f4a72b0d5fc6cb083ffab1b2a00d33
parent7b5201a60d8f00e7026a3fc4cfdd7852caa9882f (diff)
downloadgit-44d808c238f0817fc3ae7caea8f3b625b6180e37.zip
git-44d808c238f0817fc3ae7caea8f3b625b6180e37.tar.gz
git-44d808c238f0817fc3ae7caea8f3b625b6180e37.tar.bz2
http-push.c: use a faux remote to pass to http_init
This patch allows http_push to use http authentication via prompts. You may notice that there is a remote struct that only contains the url from the repo struct. This struct is a temporary fix for a larger issue, but gets http authentication via prompts out the door, and keeps users from having to store passwords in plain text files. Signed-off-by: Amos King <amos.l.king@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--http-push.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/http-push.c b/http-push.c
index dfbb247..9629348 100644
--- a/http-push.c
+++ b/http-push.c
@@ -2196,6 +2196,7 @@ int main(int argc, char **argv)
int i;
int new_refs;
struct ref *ref;
+ struct remote *remote;
char *rewritten_url = NULL;
git_extract_argv0_path(argv[0]);
@@ -2263,7 +2264,14 @@ int main(int argc, char **argv)
memset(remote_dir_exists, -1, 256);
- http_init(NULL);
+ /*
+ * Create a minimum remote by hand to give to http_init(),
+ * primarily to allow it to look at the URL.
+ */
+ remote = xcalloc(sizeof(*remote), 1);
+ ALLOC_GROW(remote->url, remote->url_nr + 1, remote->url_alloc);
+ remote->url[remote->url_nr++] = repo->url;
+ http_init(remote);
no_pragma_header = curl_slist_append(no_pragma_header, "Pragma:");