]> asedeno.scripts.mit.edu Git - git.git/blobdiff - transport.c
Merge branch 'ph/describe-match'
[git.git] / transport.c
index 4e151a9e878b402fd0b70c31057b9bcfcff7d9b7..497f85372173f6f270a4c0ee9474f165bb884413 100644 (file)
@@ -118,7 +118,7 @@ static void insert_packed_refs(const char *packed_refs, struct ref **list)
                if (hexval(buffer[0]) > 0xf)
                        continue;
                len = strlen(buffer);
-               if (buffer[len - 1] == '\n')
+               if (len && buffer[len - 1] == '\n')
                        buffer[--len] = '\0';
                if (len < 41)
                        continue;
@@ -441,11 +441,12 @@ static struct ref *get_refs_via_curl(struct transport *transport)
        struct ref *ref = NULL;
        struct ref *last_ref = NULL;
 
+       if (!transport->data)
+               transport->data = get_http_walker(transport->url);
+
        refs_url = xmalloc(strlen(transport->url) + 11);
        sprintf(refs_url, "%s/info/refs", transport->url);
 
-       http_init();
-
        slot = get_active_slot();
        slot->results = &results;
        curl_easy_setopt(slot->curl, CURLOPT_FILE, &buffer);
@@ -473,8 +474,6 @@ static struct ref *get_refs_via_curl(struct transport *transport)
                return NULL;
        }
 
-       http_cleanup();
-
        data = buffer.buf;
        start = NULL;
        mid = data;