Build-in peek-remote, using transport infrastructure.
[gitweb.git] / send-pack.c
index 25053d2c2f7daa9aa392693a892db7e80c8b6469..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;
        }
@@ -452,12 +452,10 @@ int main(int argc, char **argv)
                }
        }
 
-       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;
 }