Skip to content

Commit 1b759e0

Browse files
derrickstoleegitster
authored andcommitted
transport: rename got_remote_heads
The 'got_remote_heads' member of 'struct git_transport_data' was used historically to indicate that the initial server connection was made and the ref advertisement was returned. With protocol v2, that initial handshake does not necessarily include the ref advertisement, so this member is not an accurate name. Thankfully, all uses of the member are only checking to see if the handshake should take place, not whether or not some local data has the ref advertisement. Rename the member to 'finished_handshake' to represent the proper state. Note that the variable is only set to 1 during the handshake() method. Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7cce907 commit 1b759e0

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

transport.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ struct git_transport_data {
198198
struct git_transport_options options;
199199
struct child_process *conn;
200200
int fd[2];
201-
unsigned got_remote_heads : 1;
201+
unsigned finished_handshake : 1;
202202
enum protocol_version version;
203203
struct oid_array extra_have;
204204
struct oid_array shallow;
@@ -345,7 +345,7 @@ static struct ref *handshake(struct transport *transport, int for_push,
345345
case protocol_unknown_version:
346346
BUG("unknown protocol version");
347347
}
348-
data->got_remote_heads = 1;
348+
data->finished_handshake = 1;
349349
transport->hash_algo = reader.hash_algo;
350350

351351
if (reader.line_peeked)
@@ -421,7 +421,7 @@ static int fetch_refs_via_pack(struct transport *transport,
421421
args.negotiation_tips = data->options.negotiation_tips;
422422
args.reject_shallow_remote = transport->smart_options->reject_shallow;
423423

424-
if (!data->got_remote_heads) {
424+
if (!data->finished_handshake) {
425425
int i;
426426
int must_list_refs = 0;
427427
for (i = 0; i < nr_heads; i++) {
@@ -461,7 +461,7 @@ static int fetch_refs_via_pack(struct transport *transport,
461461
to_fetch, nr_heads, &data->shallow,
462462
&transport->pack_lockfiles, data->version);
463463

464-
data->got_remote_heads = 0;
464+
data->finished_handshake = 0;
465465
data->options.self_contained_and_connected =
466466
args.self_contained_and_connected;
467467
data->options.connectivity_checked = args.connectivity_checked;
@@ -846,7 +846,7 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re
846846
if (transport_color_config() < 0)
847847
return -1;
848848

849-
if (!data->got_remote_heads)
849+
if (!data->finished_handshake)
850850
get_refs_via_connect(transport, 1, NULL);
851851

852852
memset(&args, 0, sizeof(args));
@@ -894,7 +894,7 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re
894894
else
895895
ret = finish_connect(data->conn);
896896
data->conn = NULL;
897-
data->got_remote_heads = 0;
897+
data->finished_handshake = 0;
898898

899899
return ret;
900900
}
@@ -914,7 +914,7 @@ static int disconnect_git(struct transport *transport)
914914
{
915915
struct git_transport_data *data = transport->data;
916916
if (data->conn) {
917-
if (data->got_remote_heads && !transport->stateless_rpc)
917+
if (data->finished_handshake && !transport->stateless_rpc)
918918
packet_flush(data->fd[1]);
919919
close(data->fd[0]);
920920
if (data->fd[1] >= 0)
@@ -949,7 +949,7 @@ void transport_take_over(struct transport *transport,
949949
data->conn = child;
950950
data->fd[0] = data->conn->out;
951951
data->fd[1] = data->conn->in;
952-
data->got_remote_heads = 0;
952+
data->finished_handshake = 0;
953953
transport->data = data;
954954

955955
transport->vtable = &taken_over_vtable;
@@ -1150,7 +1150,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
11501150
ret->smart_options = &(data->options);
11511151

11521152
data->conn = NULL;
1153-
data->got_remote_heads = 0;
1153+
data->finished_handshake = 0;
11541154
} else {
11551155
/* Unknown protocol in URL. Pass to external handler. */
11561156
int len = external_specification_len(url);

0 commit comments

Comments
 (0)