summaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
authorChristian Couder <christian.couder@gmail.com>2020-05-15 10:04:49 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-05-18 19:58:01 (GMT)
commit438528f611d7bf199d68584e514a304fa4153fbb (patch)
tree15cd98d8494b6d90808055ea1f130a9ca9a18c37 /upload-pack.c
parent4ace0283b7dbfef1030d1998345a50af9946ea88 (diff)
downloadgit-438528f611d7bf199d68584e514a304fa4153fbb.zip
git-438528f611d7bf199d68584e514a304fa4153fbb.tar.gz
git-438528f611d7bf199d68584e514a304fa4153fbb.tar.bz2
upload-pack: move symref to upload_pack_data
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, we are passing around that struct to many functions, so let's also pass 'struct string_list symref' around at the same time by moving it from a local variable in upload_pack() into a field of 'struct upload_pack_data'. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/upload-pack.c b/upload-pack.c
index 399ec60..c7e35a7 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -73,6 +73,7 @@ static int allow_ref_in_want;
static int allow_sideband_all;
struct upload_pack_data {
+ struct string_list symref;
struct string_list wanted_refs;
struct object_array want_obj;
struct object_array have_obj;
@@ -100,6 +101,7 @@ struct upload_pack_data {
static void upload_pack_data_init(struct upload_pack_data *data)
{
+ struct string_list symref = STRING_LIST_INIT_DUP;
struct string_list wanted_refs = STRING_LIST_INIT_DUP;
struct object_array want_obj = OBJECT_ARRAY_INIT;
struct object_array have_obj = OBJECT_ARRAY_INIT;
@@ -108,6 +110,7 @@ static void upload_pack_data_init(struct upload_pack_data *data)
struct string_list deepen_not = STRING_LIST_INIT_DUP;
memset(data, 0, sizeof(*data));
+ data->symref = symref;
data->wanted_refs = wanted_refs;
data->want_obj = want_obj;
data->have_obj = have_obj;
@@ -119,6 +122,7 @@ static void upload_pack_data_init(struct upload_pack_data *data)
static void upload_pack_data_clear(struct upload_pack_data *data)
{
+ string_list_clear(&data->symref, 1);
string_list_clear(&data->wanted_refs, 1);
object_array_clear(&data->want_obj);
object_array_clear(&data->have_obj);
@@ -1142,7 +1146,6 @@ static int upload_pack_config(const char *var, const char *value, void *unused)
void upload_pack(struct upload_pack_options *options)
{
- struct string_list symref = STRING_LIST_INIT_DUP;
struct packet_reader reader;
struct upload_pack_data data;
@@ -1154,19 +1157,18 @@ void upload_pack(struct upload_pack_options *options)
upload_pack_data_init(&data);
- head_ref_namespaced(find_symref, &symref);
+ head_ref_namespaced(find_symref, &data.symref);
if (options->advertise_refs || !stateless_rpc) {
reset_timeout();
- head_ref_namespaced(send_ref, &symref);
- for_each_namespaced_ref(send_ref, &symref);
+ head_ref_namespaced(send_ref, &data.symref);
+ for_each_namespaced_ref(send_ref, &data.symref);
advertise_shallow_grafts(1);
packet_flush(1);
} else {
head_ref_namespaced(check_ref, NULL);
for_each_namespaced_ref(check_ref, NULL);
}
- string_list_clear(&symref, 1);
if (!options->advertise_refs) {
packet_reader_init(&reader, 0, NULL, 0,