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>
Amos King committed
Mar 18, 2009 at 18:46 UTC
44d808c238f0817fc3ae7caea8f3b625b6180e37
1 file changed
+9
-1
http-push.c
+9
-1
@@ -2196,6 +2196,7 @@ int main(int argc, char **argv)
2196
int i;
2197
int new_refs;
2198
struct ref *ref;
2199
+ struct remote *remote;
2200
char *rewritten_url = NULL;
2201
2202
git_extract_argv0_path(argv[0]);
@@ -2263,7 +2264,14 @@ int main(int argc, char **argv)
2264
2265
memset(remote_dir_exists, -1, 256);
2266
2266
- http_init(NULL);
2267
+ /*
2268
+ * Create a minimum remote by hand to give to http_init(),
2269
+ * primarily to allow it to look at the URL.
2270
+ */
2271
+ remote = xcalloc(sizeof(*remote), 1);
2272
+ ALLOC_GROW(remote->url, remote->url_nr + 1, remote->url_alloc);
2273
+ remote->url[remote->url_nr++] = repo->url;
2274
+ http_init(remote);
2275
2276
no_pragma_header = curl_slist_append(no_pragma_header, "Pragma:");
2277