X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=transport.c;h=497f85372173f6f270a4c0ee9474f165bb884413;hb=e3560df69d5ff8047bb82524ef23f7c08c729b64;hp=4e151a9e878b402fd0b70c31057b9bcfcff7d9b7;hpb=c477553b2f4f621216b25800e121af52e0750087;p=git.git diff --git a/transport.c b/transport.c index 4e151a9e8..497f85372 100644 --- a/transport.c +++ b/transport.c @@ -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;