Skip to content

Commit bf0468e

Browse files
dschogitster
authored andcommitted
upload-pack: rename enum to reflect the operation
While 3145ea9 (upload-pack: introduce fetch server command, 2018-03-15) added support for the `fetch` command, from the server's point of view it is an upload, and hence the `enum` should really be called `upload_state` instead of `fetch_state`. Likewise, rename its values. This also helps unconfuse CodeQL which would otherwise be at sixes or sevens about having _two_ non-local definitions of the same `enum` with the same values. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7f3ed75 commit bf0468e

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

upload-pack.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,16 +1780,16 @@ static void send_shallow_info(struct upload_pack_data *data)
17801780
packet_delim(1);
17811781
}
17821782

1783-
enum fetch_state {
1784-
FETCH_PROCESS_ARGS = 0,
1785-
FETCH_SEND_ACKS,
1786-
FETCH_SEND_PACK,
1787-
FETCH_DONE,
1783+
enum upload_state {
1784+
UPLOAD_PROCESS_ARGS = 0,
1785+
UPLOAD_SEND_ACKS,
1786+
UPLOAD_SEND_PACK,
1787+
UPLOAD_DONE,
17881788
};
17891789

17901790
int upload_pack_v2(struct repository *r, struct packet_reader *request)
17911791
{
1792-
enum fetch_state state = FETCH_PROCESS_ARGS;
1792+
enum upload_state state = UPLOAD_PROCESS_ARGS;
17931793
struct upload_pack_data data;
17941794

17951795
clear_object_flags(the_repository, ALL_FLAGS);
@@ -1798,9 +1798,9 @@ int upload_pack_v2(struct repository *r, struct packet_reader *request)
17981798
data.use_sideband = LARGE_PACKET_MAX;
17991799
get_upload_pack_config(r, &data);
18001800

1801-
while (state != FETCH_DONE) {
1801+
while (state != UPLOAD_DONE) {
18021802
switch (state) {
1803-
case FETCH_PROCESS_ARGS:
1803+
case UPLOAD_PROCESS_ARGS:
18041804
process_args(request, &data);
18051805

18061806
if (!data.want_obj.nr && !data.wait_for_done) {
@@ -1811,27 +1811,27 @@ int upload_pack_v2(struct repository *r, struct packet_reader *request)
18111811
* to just send 'have's without 'want's); guess
18121812
* they didn't want anything.
18131813
*/
1814-
state = FETCH_DONE;
1814+
state = UPLOAD_DONE;
18151815
} else if (data.seen_haves) {
18161816
/*
18171817
* Request had 'have' lines, so lets ACK them.
18181818
*/
1819-
state = FETCH_SEND_ACKS;
1819+
state = UPLOAD_SEND_ACKS;
18201820
} else {
18211821
/*
18221822
* Request had 'want's but no 'have's so we can
18231823
* immediately go to construct and send a pack.
18241824
*/
1825-
state = FETCH_SEND_PACK;
1825+
state = UPLOAD_SEND_PACK;
18261826
}
18271827
break;
1828-
case FETCH_SEND_ACKS:
1828+
case UPLOAD_SEND_ACKS:
18291829
if (process_haves_and_send_acks(&data))
1830-
state = FETCH_SEND_PACK;
1830+
state = UPLOAD_SEND_PACK;
18311831
else
1832-
state = FETCH_DONE;
1832+
state = UPLOAD_DONE;
18331833
break;
1834-
case FETCH_SEND_PACK:
1834+
case UPLOAD_SEND_PACK:
18351835
send_wanted_ref_info(&data);
18361836
send_shallow_info(&data);
18371837

@@ -1841,9 +1841,9 @@ int upload_pack_v2(struct repository *r, struct packet_reader *request)
18411841
packet_writer_write(&data.writer, "packfile\n");
18421842
create_pack_file(&data, NULL);
18431843
}
1844-
state = FETCH_DONE;
1844+
state = UPLOAD_DONE;
18451845
break;
1846-
case FETCH_DONE:
1846+
case UPLOAD_DONE:
18471847
continue;
18481848
}
18491849
}

0 commit comments

Comments
 (0)