Skip to content

Commit 44d808c

Browse files
adkrongitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7b5201a commit 44d808c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

http-push.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2196,6 +2196,7 @@ int main(int argc, char **argv)
21962196
int i;
21972197
int new_refs;
21982198
struct ref *ref;
2199+
struct remote *remote;
21992200
char *rewritten_url = NULL;
22002201

22012202
git_extract_argv0_path(argv[0]);
@@ -2263,7 +2264,14 @@ int main(int argc, char **argv)
22632264

22642265
memset(remote_dir_exists, -1, 256);
22652266

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);
22672275

22682276
no_pragma_header = curl_slist_append(no_pragma_header, "Pragma:");
22692277

0 commit comments

Comments
 (0)