Merge branch 'maint'
[gitweb.git] / builtin-remote.c
index 24e692953b25164e7418efc24b5cd685e61bd1d0..8fe31dbd9af2833f4dc6c3e93b9179f20d2a1d66 100644 (file)
@@ -88,18 +88,22 @@ static int add(int argc, const char **argv)
        strbuf_init(&buf, 0);
        strbuf_init(&buf2, 0);
 
+       strbuf_addf(&buf2, "refs/heads/test:refs/remotes/%s/test", name);
+       if (!valid_fetch_refspec(buf2.buf))
+               die("'%s' is not a valid remote name", name);
+
        strbuf_addf(&buf, "remote.%s.url", name);
        if (git_config_set(buf.buf, url))
                return 1;
 
+       strbuf_reset(&buf);
+       strbuf_addf(&buf, "remote.%s.fetch", name);
+
        if (track.nr == 0)
                path_list_append("*", &track);
        for (i = 0; i < track.nr; i++) {
                struct path_list_item *item = track.items + i;
 
-               strbuf_reset(&buf);
-               strbuf_addf(&buf, "remote.%s.fetch", name);
-
                strbuf_reset(&buf2);
                if (mirror)
                        strbuf_addf(&buf2, "refs/%s:refs/%s",
@@ -207,7 +211,10 @@ static int handle_one_branch(const char *refname,
        if (!remote_find_tracking(states->remote, &refspec)) {
                struct path_list_item *item;
                const char *name = skip_prefix(refspec.src, "refs/heads/");
-               if (unsorted_path_list_has_path(&states->tracked, name) ||
+               /* symbolic refs pointing nowhere were handled already */
+               if ((flags & REF_ISSYMREF) ||
+                               unsorted_path_list_has_path(&states->tracked,
+                                       name) ||
                                unsorted_path_list_has_path(&states->new,
                                        name))
                        return 0;
@@ -469,6 +476,7 @@ static int show_or_prune(int argc, const char **argv, int prune)
                                        spec->dst ? ":" : "",
                                        skip_prefix(spec->dst, "refs/heads/"));
                        }
+                       printf("\n");
                }
 cleanup_states:
                /* NEEDSWORK: free remote */