No funny names on cygwin...
[git.git] / clone-pack.c
index 9a3371e..f9b263a 100644 (file)
@@ -36,6 +36,12 @@ static void write_one_ref(struct ref *ref)
        int fd;
        char *hex;
 
+       if (!strncmp(ref->name, "refs/", 5) &&
+           check_ref_format(ref->name + 5)) {
+               error("refusing to create funny ref '%s' locally", ref->name);
+               return;
+       }
+
        if (safe_create_leading_directories(path))
                die("unable to create leading directory for %s", ref->name);
        fd = open(path, O_CREAT | O_EXCL | O_WRONLY, 0666);
@@ -281,7 +287,7 @@ static int clone_pack(int fd[2], int nr_match, char **match)
        struct ref *refs;
        int status;
 
-       get_remote_heads(fd[0], &refs, nr_match, match);
+       get_remote_heads(fd[0], &refs, nr_match, match, 1);
        if (!refs) {
                packet_flush(fd[1]);
                die("no matching remote head");