]> git.ipfire.org Git - thirdparty/git.git/commitdiff
upload-pack: move 'struct upload_pack_data' around
authorChristian Couder <christian.couder@gmail.com>
Fri, 15 May 2020 10:04:44 +0000 (12:04 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 18 May 2020 19:58:01 +0000 (12:58 -0700)
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data'
more thoroughly, let's move 'struct upload_pack_data' and the
related upload_pack_data_init() and upload_pack_data_clear()
functions towards the beginning of the file, so that this struct
and its related functions can then be used by upload_pack() in a
followup commit.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
upload-pack.c

index e1b10522f75ca3af6ec7cee1f9633ccdfec4e02e..9aeb3477c9d1a8a529410f8a7fdd06ed6e9ce154 100644 (file)
@@ -72,6 +72,62 @@ static int allow_ref_in_want;
 
 static int allow_sideband_all;
 
+struct upload_pack_data {
+       struct string_list wanted_refs;
+       struct object_array want_obj;
+       struct object_array have_obj;
+       struct oid_array haves;
+
+       struct object_array shallows;
+       struct string_list deepen_not;
+       int depth;
+       timestamp_t deepen_since;
+       int deepen_rev_list;
+       int deepen_relative;
+
+       struct list_objects_filter_options filter_options;
+
+       struct packet_writer writer;
+
+       unsigned stateless_rpc : 1;
+
+       unsigned use_thin_pack : 1;
+       unsigned use_ofs_delta : 1;
+       unsigned no_progress : 1;
+       unsigned use_include_tag : 1;
+       unsigned done : 1;
+};
+
+static void upload_pack_data_init(struct upload_pack_data *data)
+{
+       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;
+       struct oid_array haves = OID_ARRAY_INIT;
+       struct object_array shallows = OBJECT_ARRAY_INIT;
+       struct string_list deepen_not = STRING_LIST_INIT_DUP;
+
+       memset(data, 0, sizeof(*data));
+       data->wanted_refs = wanted_refs;
+       data->want_obj = want_obj;
+       data->have_obj = have_obj;
+       data->haves = haves;
+       data->shallows = shallows;
+       data->deepen_not = deepen_not;
+       packet_writer_init(&data->writer, 1);
+}
+
+static void upload_pack_data_clear(struct upload_pack_data *data)
+{
+       string_list_clear(&data->wanted_refs, 1);
+       object_array_clear(&data->want_obj);
+       object_array_clear(&data->have_obj);
+       oid_array_clear(&data->haves);
+       object_array_clear(&data->shallows);
+       string_list_clear(&data->deepen_not, 0);
+       list_objects_filter_release(&data->filter_options);
+}
+
 static void reset_timeout(void)
 {
        alarm(timeout);
@@ -1130,62 +1186,6 @@ void upload_pack(struct upload_pack_options *options)
        list_objects_filter_release(&filter_options);
 }
 
-struct upload_pack_data {
-       struct string_list wanted_refs;
-       struct object_array want_obj;
-       struct object_array have_obj;
-       struct oid_array haves;
-
-       struct object_array shallows;
-       struct string_list deepen_not;
-       int depth;
-       timestamp_t deepen_since;
-       int deepen_rev_list;
-       int deepen_relative;
-
-       struct list_objects_filter_options filter_options;
-
-       struct packet_writer writer;
-
-       unsigned stateless_rpc : 1;
-
-       unsigned use_thin_pack : 1;
-       unsigned use_ofs_delta : 1;
-       unsigned no_progress : 1;
-       unsigned use_include_tag : 1;
-       unsigned done : 1;
-};
-
-static void upload_pack_data_init(struct upload_pack_data *data)
-{
-       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;
-       struct oid_array haves = OID_ARRAY_INIT;
-       struct object_array shallows = OBJECT_ARRAY_INIT;
-       struct string_list deepen_not = STRING_LIST_INIT_DUP;
-
-       memset(data, 0, sizeof(*data));
-       data->wanted_refs = wanted_refs;
-       data->want_obj = want_obj;
-       data->have_obj = have_obj;
-       data->haves = haves;
-       data->shallows = shallows;
-       data->deepen_not = deepen_not;
-       packet_writer_init(&data->writer, 1);
-}
-
-static void upload_pack_data_clear(struct upload_pack_data *data)
-{
-       string_list_clear(&data->wanted_refs, 1);
-       object_array_clear(&data->want_obj);
-       object_array_clear(&data->have_obj);
-       oid_array_clear(&data->haves);
-       object_array_clear(&data->shallows);
-       string_list_clear(&data->deepen_not, 0);
-       list_objects_filter_release(&data->filter_options);
-}
-
 static int parse_want(struct packet_writer *writer, const char *line,
                      struct object_array *want_obj)
 {