diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2013-12-05 20:02:33 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-12-10 16:14:16 -0800 |
commit | b06dcd7d6829c86afda6b311cadf009ee4b4dd59 (patch) | |
tree | 6db0d883cc38fb1ed50038df1e880f6c7616d0f2 /connect.c | |
parent | ad491366de6c883cd04539cb86db31049201dfbd (diff) | |
download | git-b06dcd7d6829c86afda6b311cadf009ee4b4dd59.tar.gz |
connect.c: teach get_remote_heads to parse "shallow" lines
No callers pass a non-empty pointer as shallow_points at this
stage. As a result, all clients still refuse to talk to shallow
repository on the other end.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'connect.c')
-rw-r--r-- | connect.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -116,7 +116,8 @@ static void annotate_refs_with_symref_info(struct ref *ref) */ struct ref **get_remote_heads(int in, char *src_buf, size_t src_len, struct ref **list, unsigned int flags, - struct sha1_array *extra_have) + struct sha1_array *extra_have, + struct sha1_array *shallow_points) { struct ref **orig_list = list; int got_at_least_one_head = 0; @@ -142,6 +143,15 @@ struct ref **get_remote_heads(int in, char *src_buf, size_t src_len, if (len > 4 && !prefixcmp(buffer, "ERR ")) die("remote error: %s", buffer + 4); + if (len == 48 && !prefixcmp(buffer, "shallow ")) { + if (get_sha1_hex(buffer + 8, old_sha1)) + die("protocol error: expected shallow sha-1, got '%s'", buffer + 8); + if (!shallow_points) + die("repository on the other end cannot be shallow"); + sha1_array_append(shallow_points, old_sha1); + continue; + } + if (len < 42 || get_sha1_hex(buffer, old_sha1) || buffer[40] != ' ') die("protocol error: expected sha/ref, got '%s'", buffer); name = buffer + 41; |