Browse Source

upload-pack: pass upload_pack_data to got_oid()

As we cleanup 'upload-pack.c' by using 'struct upload_pack_data'
more thoroughly, let's pass that struct to got_oid(), so that
this function can use all the fields of the struct.

This will be used in followup commits to move a static variable
into 'upload_pack_data'.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Christian Couder 4 years ago committed by Junio C Hamano
parent
commit
460ed0d4b4
  1. 8
      upload-pack.c

8
upload-pack.c

@ -393,8 +393,8 @@ static void create_pack_file(struct upload_pack_data *pack_data)
die("git upload-pack: %s", abort_msg); die("git upload-pack: %s", abort_msg);
} }


static int got_oid(const char *hex, struct object_id *oid, static int got_oid(struct upload_pack_data *data,
struct object_array *have_obj) const char *hex, struct object_id *oid)
{ {
struct object *o; struct object *o;
int we_knew_they_have = 0; int we_knew_they_have = 0;
@ -422,7 +422,7 @@ static int got_oid(const char *hex, struct object_id *oid,
parents->item->object.flags |= THEY_HAVE; parents->item->object.flags |= THEY_HAVE;
} }
if (!we_knew_they_have) { if (!we_knew_they_have) {
add_object_array(o, NULL, have_obj); add_object_array(o, NULL, &data->have_obj);
return 1; return 1;
} }
return 0; return 0;
@ -478,7 +478,7 @@ static int get_common_commits(struct upload_pack_data *data,
continue; continue;
} }
if (skip_prefix(reader->line, "have ", &arg)) { if (skip_prefix(reader->line, "have ", &arg)) {
switch (got_oid(arg, &oid, &data->have_obj)) { switch (got_oid(data, arg, &oid)) {
case -1: /* they have what we do not */ case -1: /* they have what we do not */
got_other = 1; got_other = 1;
if (data->multi_ack if (data->multi_ack

Loading…
Cancel
Save