Skip to content

Commit b08c974

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

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

upload-pack.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,7 @@ static int has_unreachable(struct object_array *src)
654654
return 1;
655655
}
656656

657-
static void check_non_tip(struct object_array *want_obj,
658-
struct packet_writer *writer)
657+
static void check_non_tip(struct upload_pack_data *data)
659658
{
660659
int i;
661660

@@ -666,16 +665,16 @@ static void check_non_tip(struct object_array *want_obj,
666665
*/
667666
if (!stateless_rpc && !(allow_unadvertised_object_request & ALLOW_REACHABLE_SHA1))
668667
goto error;
669-
if (!has_unreachable(want_obj))
668+
if (!has_unreachable(&data->want_obj))
670669
/* All the non-tip ones are ancestors of what we advertised */
671670
return;
672671

673672
error:
674673
/* Pick one of them (we know there at least is one) */
675-
for (i = 0; i < want_obj->nr; i++) {
676-
struct object *o = want_obj->objects[i].item;
674+
for (i = 0; i < data->want_obj.nr; i++) {
675+
struct object *o = data->want_obj.objects[i].item;
677676
if (!is_our_ref(o)) {
678-
packet_writer_error(writer,
677+
packet_writer_error(&data->writer,
679678
"upload-pack: not our ref %s",
680679
oid_to_hex(&o->oid));
681680
die("git upload-pack: not our ref %s",
@@ -1003,7 +1002,7 @@ static void receive_needs(struct upload_pack_data *data,
10031002
* by another process that handled the initial request.
10041003
*/
10051004
if (has_non_tip)
1006-
check_non_tip(&data->want_obj, &data->writer);
1005+
check_non_tip(data);
10071006

10081007
if (!use_sideband && daemon_mode)
10091008
no_progress = 1;

0 commit comments

Comments
 (0)