[WIP Patch 09/12] Use the new http API in fetch_symref()
Signed-off-by: Mike Hommey <mh@glandium.org>
---
http-push.c | 19 ++-----------------
1 files changed, 2 insertions(+), 17 deletions(-)
diff --git a/http-push.c b/http-push.c
index 7627860..b32def4 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1982,27 +1982,12 @@ static void fetch_symref(const char *path, char **symref, unsigned char *sha1)
{
char *url;
struct strbuf buffer = STRBUF_INIT;
- struct active_request_slot *slot;
- struct slot_results results;
url = xmalloc(strlen(remote->url) + strlen(path) + 1);
sprintf(url, "%s%s", remote->url, path);
- slot = get_active_slot();
- slot->results = &results;
- curl_easy_setopt(slot->curl, CURLOPT_FILE, &buffer);
- 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");
- }
+ if (http_get_strbuf(url, &buffer, 0) != HTTP_OK)
+ die("Couldn't get %s for remote symref\n", url);
free(url);
free(*symref);
--
1.6.1.141.gb32a