Build-in peek-remote, using transport infrastructure.
[gitweb.git] / send-pack.c
index 1a7397f3a65864524ef735d094d171bca6a0d067..456fe4f125f4c2b56301f8b1b8c62b6807e10d3b 100644 (file)
@@ -207,7 +207,7 @@ static void update_tracking_ref(struct remote *remote, struct ref *ref)
        }
 }
 
-static int send_pack(int in, int out, struct remote *remote, int nr_refspec, char **refspec)
+static int send_pack(int in, int out, struct remote *remote, int nr_refspec, const char **refspec)
 {
        struct ref *ref;
        int new_refs;
@@ -357,7 +357,7 @@ static int send_pack(int in, int out, struct remote *remote, int nr_refspec, cha
        return ret;
 }
 
-static void verify_remote_names(int nr_heads, char **heads)
+static void verify_remote_names(int nr_heads, const char **heads)
 {
        int i;
 
@@ -382,9 +382,9 @@ int main(int argc, char **argv)
 {
        int i, nr_heads = 0;
        char *dest = NULL;
-       char **heads = NULL;
+       const char **heads = NULL;
        int fd[2], ret;
-       pid_t pid;
+       struct child_process *conn;
        char *remote_name = NULL;
        struct remote *remote = NULL;
 
@@ -434,7 +434,7 @@ int main(int argc, char **argv)
                        dest = arg;
                        continue;
                }
-               heads = argv;
+               heads = (const char **) argv;
                nr_heads = argc - i;
                break;
        }
@@ -446,18 +446,16 @@ int main(int argc, char **argv)
 
        if (remote_name) {
                remote = remote_get(remote_name);
-               if (!remote_has_uri(remote, dest)) {
+               if (!remote_has_url(remote, dest)) {
                        die("Destination %s is not a uri for %s",
                            dest, remote_name);
                }
        }
 
-       pid = git_connect(fd, dest, receivepack, verbose ? CONNECT_VERBOSE : 0);
-       if (pid < 0)
-               return 1;
+       conn = git_connect(fd, dest, receivepack, verbose ? CONNECT_VERBOSE : 0);
        ret = send_pack(fd[0], fd[1], remote, nr_heads, heads);
        close(fd[0]);
        close(fd[1]);
-       ret |= finish_connect(pid);
+       ret |= finish_connect(conn);
        return !!ret;
 }