We do not like "HEAD" as a new branch name
[git.git] / clone-pack.c
index 4f4975b..b5ce5d3 100644 (file)
@@ -211,7 +211,7 @@ static int clone_without_unpack(int fd[2])
 
        ifd = fd[0];
        snprintf(tmpfile, sizeof(tmpfile),
-                "%s/pack-XXXXXX", get_object_directory());
+                "%s/pack/tmp-XXXXXX", get_object_directory());
        ofd = mkstemp(tmpfile);
        if (ofd < 0)
                return error("unable to create temporary file %s", tmpfile);
@@ -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++) {