diff options
Diffstat (limited to 'transport.c')
-rw-r--r-- | transport.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/transport.c b/transport.c index 6cf3da19eb..17e9629710 100644 --- a/transport.c +++ b/transport.c @@ -147,9 +147,11 @@ static struct ref *get_refs_from_bundle(struct transport *transport, transport->hash_algo = data->header.hash_algo; for (i = 0; i < data->header.references.nr; i++) { - struct ref_list_entry *e = data->header.references.list + i; - struct ref *ref = alloc_ref(e->name); - oidcpy(&ref->old_oid, &e->oid); + struct string_list_item *e = data->header.references.items + i; + const char *name = e->string; + struct ref *ref = alloc_ref(name); + struct object_id *oid = e->util; + oidcpy(&ref->old_oid, oid); ref->next = result; result = ref; } @@ -175,6 +177,7 @@ static int close_bundle(struct transport *transport) struct bundle_transport_data *data = transport->data; if (data->fd > 0) close(data->fd); + bundle_header_release(&data->header); free(data); return 0; } @@ -427,7 +430,8 @@ static int fetch_refs_via_pack(struct transport *transport, cleanup: close(data->fd[0]); - close(data->fd[1]); + if (data->fd[1] >= 0) + close(data->fd[1]); if (finish_connect(data->conn)) ret = -1; data->conn = NULL; @@ -869,7 +873,8 @@ static int disconnect_git(struct transport *transport) if (data->got_remote_heads && !transport->stateless_rpc) packet_flush(data->fd[1]); close(data->fd[0]); - close(data->fd[1]); + if (data->fd[1] >= 0) + close(data->fd[1]); finish_connect(data->conn); } @@ -1050,7 +1055,7 @@ struct transport *transport_get(struct remote *remote, const char *url) struct transport *ret = xcalloc(1, sizeof(*ret)); ret->progress = isatty(2); - string_list_init(&ret->pack_lockfiles, 1); + string_list_init_dup(&ret->pack_lockfiles); if (!remote) BUG("No remote provided to transport_get()"); @@ -1079,6 +1084,7 @@ struct transport *transport_get(struct remote *remote, const char *url) die(_("git-over-rsync is no longer supported")); } else if (url_is_local_not_ssh(url) && is_file(url) && is_bundle(url, 1)) { struct bundle_transport_data *data = xcalloc(1, sizeof(*data)); + bundle_header_init(&data->header); transport_check_allowed("file"); ret->data = data; ret->vtable = &bundle_vtable; |