clone-pack: make it usable for partial branch cloning.
[git.git] / clone-pack.c
index 9609219..b5ce5d3 100644 (file)
@@ -259,8 +259,17 @@ static int clone_pack(int fd[2], int nr_match, char **match)
 
        status = clone_without_unpack(fd);
 
-       if (!status)
-               write_refs(refs);
+       if (!status) {
+               if (nr_match == 0)
+                       write_refs(refs);
+               else
+                       while (refs) {
+                               printf("%s %s\n",
+                                      sha1_to_hex(refs->old_sha1),
+                                      refs->name);
+                               refs = refs->next;
+                       }
+       }
        return status;
 }
 
@@ -271,6 +280,8 @@ int main(int argc, char **argv)
        int fd[2];
        pid_t pid;
 
+       setup_git_directory();
+
        nr_heads = 0;
        heads = NULL;
        for (i = 1; i < argc; i++) {