@matheusbsbs / matheus-bagliano / commits / 4ace0283b7
Fork 0

upload-pack: use upload_pack_data writer in receive_needs()

As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's use the 'struct packet_writer writer' field from 'struct upload_pack_data' in receive_needs(), instead of a local 'struct packet_writer writer' variable. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Christian Couder committed May 15, 2020 at 12:04 UTC 4ace0283b7dbfef1030d1998345a50af9946ea88
1 file changed +3 -5
upload-pack.c
+3 -5
@@ -917,10 +917,8 @@ static void receive_needs(struct upload_pack_data *data,
917 timestamp_t deepen_since = 0;
918 int deepen_rev_list = 0;
919 int deepen_relative = 0;
920 - struct packet_writer writer;
920
921 shallow_nr = 0;
923 - packet_writer_init(&writer, 1);
922 for (;;) {
923 struct object *o;
924 const char *features;
@@ -978,7 +976,7 @@ static void receive_needs(struct upload_pack_data *data,
976
977 o = parse_object(the_repository, &oid_buf);
978 if (!o) {
981 - packet_writer_error(&writer,
979 + packet_writer_error(&data->writer,
980 "upload-pack: not our ref %s",
981 oid_to_hex(&oid_buf));
982 die("git upload-pack: not our ref %s",
@@ -1001,7 +999,7 @@ static void receive_needs(struct upload_pack_data *data,
999 * by another process that handled the initial request.
1000 */
1001 if (has_non_tip)
1004 - check_non_tip(&data->want_obj, &writer);
1002 + check_non_tip(&data->want_obj, &data->writer);
1003
1004 if (!use_sideband && daemon_mode)
1005 no_progress = 1;
@@ -1009,7 +1007,7 @@ static void receive_needs(struct upload_pack_data *data,
1007 if (depth == 0 && !deepen_rev_list && shallows.nr == 0)
1008 return;
1009
1012 - if (send_shallow_list(&writer, depth, deepen_rev_list, deepen_since,
1010 + if (send_shallow_list(&data->writer, depth, deepen_rev_list, deepen_since,
1011 &deepen_not, deepen_relative, &shallows,
1012 &data->want_obj))
1013 packet_flush(1);