Skip to content

Commit 67e9a70

Browse files
bk2204gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7f46e7e commit 67e9a70

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

connect.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,14 +374,15 @@ struct ref **get_remote_heads(struct packet_reader *reader,
374374
}
375375

376376
/* 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)
378378
{
379379
int ret = 1;
380380
int i = 0;
381381
struct object_id old_oid;
382382
struct ref *ref;
383383
struct string_list line_sections = STRING_LIST_INIT_DUP;
384384
const char *end;
385+
const char *line = reader->line;
385386

386387
/*
387388
* 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,
469470

470471
/* Process response from server */
471472
while (packet_reader_read(reader) == PACKET_READ_NORMAL) {
472-
if (!process_ref_v2(reader->line, &list))
473+
if (!process_ref_v2(reader, &list))
473474
die(_("invalid ls-refs response: %s"), reader->line);
474475
}
475476

0 commit comments

Comments
 (0)