http-push.c::fetch_symref(): use the new http API
Signed-off-by: Mike Hommey <mh@glandium.org> Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
446b941a57
commit
9af5abd993
20
http-push.c
20
http-push.c
@ -2028,27 +2028,13 @@ static void fetch_symref(const char *path, char **symref, unsigned char *sha1)
|
|||||||
{
|
{
|
||||||
char *url;
|
char *url;
|
||||||
struct strbuf buffer = STRBUF_INIT;
|
struct strbuf buffer = STRBUF_INIT;
|
||||||
struct active_request_slot *slot;
|
|
||||||
struct slot_results results;
|
|
||||||
|
|
||||||
url = xmalloc(strlen(repo->url) + strlen(path) + 1);
|
url = xmalloc(strlen(repo->url) + strlen(path) + 1);
|
||||||
sprintf(url, "%s%s", repo->url, path);
|
sprintf(url, "%s%s", repo->url, path);
|
||||||
|
|
||||||
slot = get_active_slot();
|
if (http_get_strbuf(url, &buffer, 0) != HTTP_OK)
|
||||||
slot->results = &results;
|
die("Couldn't get %s for remote symref\n%s", url,
|
||||||
curl_easy_setopt(slot->curl, CURLOPT_FILE, &buffer);
|
curl_errorstr);
|
||||||
curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);
|
|
||||||
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, NULL);
|
|
||||||
curl_easy_setopt(slot->curl, CURLOPT_URL, url);
|
|
||||||
if (start_active_slot(slot)) {
|
|
||||||
run_active_slot(slot);
|
|
||||||
if (results.curl_result != CURLE_OK) {
|
|
||||||
die("Couldn't get %s for remote symref\n%s",
|
|
||||||
url, curl_errorstr);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
die("Unable to start remote symref request");
|
|
||||||
}
|
|
||||||
free(url);
|
free(url);
|
||||||
|
|
||||||
free(*symref);
|
free(*symref);
|
||||||
|
Loading…
Reference in New Issue
Block a user