connect: pass full packet reader when parsing v2 refs
When we're parsing refs, we need to know not only what the line we're parsing is, but also the hash algorithm we should use to parse it, which is stored in the reader object. Pass the packet reader object through to the protocol v2 ref parsing function. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
May 25, 2020 at 19:59 UTC
67e9a70741c577b6e49bd60556779c7ab32ae4f8
1 file changed
+3
-2
connect.c
+3
-2
@@ -374,7 +374,7 @@ struct ref **get_remote_heads(struct packet_reader *reader,
374
}
375
376
/* Returns 1 when a valid ref has been added to `list`, 0 otherwise */
377
-static int process_ref_v2(const char *line, struct ref ***list)
377
+static int process_ref_v2(struct packet_reader *reader, struct ref ***list)
378
{
379
int ret = 1;
380
int i = 0;
@@ -382,6 +382,7 @@ static int process_ref_v2(const char *line, struct ref ***list)
382
struct ref *ref;
383
struct string_list line_sections = STRING_LIST_INIT_DUP;
384
const char *end;
385
+ const char *line = reader->line;
386
387
/*
388
* Ref lines have a number of fields which are space deliminated. The
@@ -469,7 +470,7 @@ struct ref **get_remote_refs(int fd_out, struct packet_reader *reader,
470
471
/* Process response from server */
472
while (packet_reader_read(reader) == PACKET_READ_NORMAL) {
472
- if (!process_ref_v2(reader->line, &list))
473
+ if (!process_ref_v2(reader, &list))
474
die(_("invalid ls-refs response: %s"), reader->line);
475
}
476