summaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2020-05-25 19:59:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-05-27 17:07:07 (GMT)
commit67e9a70741c577b6e49bd60556779c7ab32ae4f8 (patch)
tree68b0791409b158f1853d803ca0bb221f229b5992 /connect.c
parent7f46e7ead1d82538866265228f9d743f0e93e17a (diff)
downloadgit-67e9a70741c577b6e49bd60556779c7ab32ae4f8.zip
git-67e9a70741c577b6e49bd60556779c7ab32ae4f8.tar.gz
git-67e9a70741c577b6e49bd60556779c7ab32ae4f8.tar.bz2
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>
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/connect.c b/connect.c
index 915f173..1d05bc5 100644
--- a/connect.c
+++ b/connect.c
@@ -374,7 +374,7 @@ struct ref **get_remote_heads(struct packet_reader *reader,
}
/* Returns 1 when a valid ref has been added to `list`, 0 otherwise */
-static int process_ref_v2(const char *line, struct ref ***list)
+static int process_ref_v2(struct packet_reader *reader, struct ref ***list)
{
int ret = 1;
int i = 0;
@@ -382,6 +382,7 @@ static int process_ref_v2(const char *line, struct ref ***list)
struct ref *ref;
struct string_list line_sections = STRING_LIST_INIT_DUP;
const char *end;
+ const char *line = reader->line;
/*
* 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,
/* Process response from server */
while (packet_reader_read(reader) == PACKET_READ_NORMAL) {
- if (!process_ref_v2(reader->line, &list))
+ if (!process_ref_v2(reader, &list))
die(_("invalid ls-refs response: %s"), reader->line);
}