transport: use designated initializers
Change the assignments to the various transport_vtables to use designated initializers, this makes the code easier to read and maintain. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
9b1cdd334d
commit
1fd88224a3
@ -1261,12 +1261,12 @@ static struct ref *get_refs_list_using_list(struct transport *transport,
|
||||
}
|
||||
|
||||
static struct transport_vtable vtable = {
|
||||
set_helper_option,
|
||||
get_refs_list,
|
||||
fetch_refs,
|
||||
push_refs,
|
||||
connect_helper,
|
||||
release_helper
|
||||
.set_option = set_helper_option,
|
||||
.get_refs_list = get_refs_list,
|
||||
.fetch_refs = fetch_refs,
|
||||
.push_refs = push_refs,
|
||||
.connect = connect_helper,
|
||||
.disconnect = release_helper
|
||||
};
|
||||
|
||||
int transport_helper_init(struct transport *transport, const char *name)
|
||||
|
30
transport.c
30
transport.c
@ -883,12 +883,10 @@ static int disconnect_git(struct transport *transport)
|
||||
}
|
||||
|
||||
static struct transport_vtable taken_over_vtable = {
|
||||
NULL,
|
||||
get_refs_via_connect,
|
||||
fetch_refs_via_pack,
|
||||
git_transport_push,
|
||||
NULL,
|
||||
disconnect_git
|
||||
.get_refs_list = get_refs_via_connect,
|
||||
.fetch_refs = fetch_refs_via_pack,
|
||||
.push_refs = git_transport_push,
|
||||
.disconnect = disconnect_git
|
||||
};
|
||||
|
||||
void transport_take_over(struct transport *transport,
|
||||
@ -1032,21 +1030,17 @@ void transport_check_allowed(const char *type)
|
||||
}
|
||||
|
||||
static struct transport_vtable bundle_vtable = {
|
||||
NULL,
|
||||
get_refs_from_bundle,
|
||||
fetch_refs_from_bundle,
|
||||
NULL,
|
||||
NULL,
|
||||
close_bundle
|
||||
.get_refs_list = get_refs_from_bundle,
|
||||
.fetch_refs = fetch_refs_from_bundle,
|
||||
.disconnect = close_bundle
|
||||
};
|
||||
|
||||
static struct transport_vtable builtin_smart_vtable = {
|
||||
NULL,
|
||||
get_refs_via_connect,
|
||||
fetch_refs_via_pack,
|
||||
git_transport_push,
|
||||
connect_git,
|
||||
disconnect_git
|
||||
.get_refs_list = get_refs_via_connect,
|
||||
.fetch_refs = fetch_refs_via_pack,
|
||||
.push_refs = git_transport_push,
|
||||
.connect = connect_git,
|
||||
.disconnect = disconnect_git
|
||||
};
|
||||
|
||||
struct transport *transport_get(struct remote *remote, const char *url)
|
||||
|
Loading…
Reference in New Issue
Block a user