Skip to content

Commit c9f0325

Browse files
chriscoolgitster
authored andcommitted
upload-pack: pass upload_pack_data to create_pack_file()
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's pass that struct to create_pack_file(), so that this function, and the function it calls, can use all the fields of the struct. Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent df654ab commit c9f0325

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

upload-pack.c

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,7 @@ static int write_one_shallow(const struct commit_graft *graft, void *cb_data)
161161
return 0;
162162
}
163163

164-
static void create_pack_file(const struct object_array *have_obj,
165-
const struct object_array *want_obj,
166-
struct list_objects_filter_options *filter_options)
164+
static void create_pack_file(struct upload_pack_data *pack_data)
167165
{
168166
struct child_process pack_objects = CHILD_PROCESS_INIT;
169167
char data[8193], progress[128];
@@ -200,9 +198,9 @@ static void create_pack_file(const struct object_array *have_obj,
200198
argv_array_push(&pack_objects.args, "--delta-base-offset");
201199
if (use_include_tag)
202200
argv_array_push(&pack_objects.args, "--include-tag");
203-
if (filter_options->choice) {
201+
if (pack_data->filter_options.choice) {
204202
const char *spec =
205-
expand_list_objects_filter_spec(filter_options);
203+
expand_list_objects_filter_spec(&pack_data->filter_options);
206204
if (pack_objects.use_shell) {
207205
struct strbuf buf = STRBUF_INIT;
208206
sq_quote_buf(&buf, spec);
@@ -226,13 +224,13 @@ static void create_pack_file(const struct object_array *have_obj,
226224
if (shallow_nr)
227225
for_each_commit_graft(write_one_shallow, pipe_fd);
228226

229-
for (i = 0; i < want_obj->nr; i++)
227+
for (i = 0; i < pack_data->want_obj.nr; i++)
230228
fprintf(pipe_fd, "%s\n",
231-
oid_to_hex(&want_obj->objects[i].item->oid));
229+
oid_to_hex(&pack_data->want_obj.objects[i].item->oid));
232230
fprintf(pipe_fd, "--not\n");
233-
for (i = 0; i < have_obj->nr; i++)
231+
for (i = 0; i < pack_data->have_obj.nr; i++)
234232
fprintf(pipe_fd, "%s\n",
235-
oid_to_hex(&have_obj->objects[i].item->oid));
233+
oid_to_hex(&pack_data->have_obj.objects[i].item->oid));
236234
for (i = 0; i < extra_edge_obj.nr; i++)
237235
fprintf(pipe_fd, "%s\n",
238236
oid_to_hex(&extra_edge_obj.objects[i].item->oid));
@@ -1179,9 +1177,7 @@ void upload_pack(struct upload_pack_options *options)
11791177
receive_needs(&data, &reader);
11801178
if (data.want_obj.nr) {
11811179
get_common_commits(&data, &reader);
1182-
create_pack_file(&data.have_obj,
1183-
&data.want_obj,
1184-
&data.filter_options);
1180+
create_pack_file(&data);
11851181
}
11861182
}
11871183

@@ -1525,9 +1521,7 @@ int upload_pack_v2(struct repository *r, struct argv_array *keys,
15251521
send_shallow_info(&data);
15261522

15271523
packet_writer_write(&data.writer, "packfile\n");
1528-
create_pack_file(&data.have_obj,
1529-
&data.want_obj,
1530-
&data.filter_options);
1524+
create_pack_file(&data);
15311525
state = FETCH_DONE;
15321526
break;
15331527
case FETCH_DONE:

0 commit comments

Comments
 (0)