From: Jonathan Nieder Date: Mon, 14 Oct 2013 18:06:57 +0000 (-0700) Subject: Merge branch 'nd/clone-local-with-colon' X-Git-Tag: v1.8.5-rc0~64 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/cabb411fcf6a0a0f5058f2fee0f628e9a16a6fcb?ds=inline;hp=-c Merge branch 'nd/clone-local-with-colon' * nd/clone-local-with-colon: clone: tighten "local paths with colons" check a bit --- cabb411fcf6a0a0f5058f2fee0f628e9a16a6fcb diff --combined connect.c index a80ebd316c,3c6300a21b..40868610ab --- a/connect.c +++ b/connect.c @@@ -5,7 -5,6 +5,7 @@@ #include "refs.h" #include "run-command.h" #include "remote.h" +#include "connect.h" #include "url.h" static char *server_capabilities; @@@ -63,8 -62,8 +63,8 @@@ static void die_initial_contact(int got /* * Read all the refs from the other end */ -struct ref **get_remote_heads(int in, struct ref **list, - unsigned int flags, +struct ref **get_remote_heads(int in, char *src_buf, size_t src_len, + struct ref **list, unsigned int flags, struct extra_have_objects *extra_have) { int got_at_least_one_head = 0; @@@ -73,19 -72,18 +73,19 @@@ for (;;) { struct ref *ref; unsigned char old_sha1[20]; - static char buffer[1000]; char *name; int len, name_len; + char *buffer = packet_buffer; - len = packet_read(in, buffer, sizeof(buffer)); + len = packet_read(in, &src_buf, &src_len, + packet_buffer, sizeof(packet_buffer), + PACKET_READ_GENTLE_ON_EOF | + PACKET_READ_CHOMP_NEWLINE); if (len < 0) die_initial_contact(got_at_least_one_head); if (!len) break; - if (buffer[len-1] == '\n') - buffer[--len] = 0; if (len > 4 && !prefixcmp(buffer, "ERR ")) die("remote error: %s", buffer + 4); @@@ -552,7 -550,7 +552,7 @@@ struct child_process *git_connect(int f path = strchr(end, c); if (path && !has_dos_drive_prefix(end)) { if (c == ':') { - if (path < strchrnul(host, '/')) { + if (host != url || path < strchrnul(host, '/')) { protocol = PROTO_SSH; *path++ = '\0'; } else /* '/' in the host part, assume local path */