]> asedeno.scripts.mit.edu Git - git.git/blobdiff - connect.c
Replace calls to strbuf_init(&foo, 0) with STRBUF_INIT initializer
[git.git] / connect.c
index d12b105970bca82017998cae52f5807629736bb9..67d2cd86a89a92f8f75baa7ae5e820ac3150f3b4 100644 (file)
--- a/connect.c
+++ b/connect.c
@@ -41,12 +41,20 @@ int check_ref_type(const struct ref *ref, int flags)
        return check_ref(ref->name, strlen(ref->name), flags);
 }
 
+static void add_extra_have(struct extra_have_objects *extra, unsigned char *sha1)
+{
+       ALLOC_GROW(extra->array, extra->nr + 1, extra->alloc);
+       hashcpy(&(extra->array[extra->nr][0]), sha1);
+       extra->nr++;
+}
+
 /*
  * Read all the refs from the other end
  */
 struct ref **get_remote_heads(int in, struct ref **list,
                              int nr_match, char **match,
-                             unsigned int flags)
+                             unsigned int flags,
+                             struct extra_have_objects *extra_have)
 {
        *list = NULL;
        for (;;) {
@@ -72,6 +80,12 @@ struct ref **get_remote_heads(int in, struct ref **list,
                        server_capabilities = xstrdup(name + name_len + 1);
                }
 
+               if (extra_have &&
+                   name_len == 5 && !memcmp(".have", name, 5)) {
+                       add_extra_have(extra_have, old_sha1);
+                       continue;
+               }
+
                if (!check_ref(name, name_len, flags))
                        continue;
                if (nr_match && !path_match(name, nr_match, match))
@@ -97,7 +111,7 @@ int get_ack(int fd, unsigned char *result_sha1)
        int len = packet_read_line(fd, line, sizeof(line));
 
        if (!len)
-               die("git-fetch-pack: expected ACK/NAK, got EOF");
+               die("git fetch-pack: expected ACK/NAK, got EOF");
        if (line[len-1] == '\n')
                line[--len] = 0;
        if (!strcmp(line, "NAK"))
@@ -109,7 +123,7 @@ int get_ack(int fd, unsigned char *result_sha1)
                        return 1;
                }
        }
-       die("git-fetch_pack: expected ACK/NAK, got '%s'", line);
+       die("git fetch_pack: expected ACK/NAK, got '%s'", line);
 }
 
 int path_match(const char *path, int nr, char **match)
@@ -360,7 +374,8 @@ static char *git_proxy_command;
 static const char *rhost_name;
 static int rhost_len;
 
-static int git_proxy_command_options(const char *var, const char *value)
+static int git_proxy_command_options(const char *var, const char *value,
+               void *cb)
 {
        if (!strcmp(var, "core.gitproxy")) {
                const char *for_pos;
@@ -404,7 +419,7 @@ static int git_proxy_command_options(const char *var, const char *value)
                return 0;
        }
 
-       return git_default_config(var, value);
+       return git_default_config(var, value, cb);
 }
 
 static int git_use_proxy(const char *host)
@@ -412,7 +427,7 @@ static int git_use_proxy(const char *host)
        rhost_name = host;
        rhost_len = strlen(host);
        git_proxy_command = getenv("GIT_PROXY_COMMAND");
-       git_config(git_proxy_command_options);
+       git_config(git_proxy_command_options, NULL);
        rhost_name = NULL;
        return (git_proxy_command && *git_proxy_command);
 }
@@ -528,7 +543,7 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
                end = host;
 
        path = strchr(end, c);
-       if (path) {
+       if (path && !has_dos_drive_prefix(end)) {
                if (c == ':') {
                        protocol = PROTO_SSH;
                        *path++ = '\0';