Code

t7800: respect NO_PERL
[git.git] / remote.c
index 2b037f11b29d86e38d6608a58c65e79e0ffd3800..d66e2f3c93dc72a7112ce101278ae937cc914320 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -366,7 +366,7 @@ static int handle_config(const char *key, const char *value, void *cb)
        }
        subkey = strrchr(name, '.');
        if (!subkey)
-               return error("Config with no key for remote %s", name);
+               return 0;
        remote = make_remote(name, subkey - name);
        remote->origin = REMOTE_CONFIG;
        if (!strcmp(subkey, ".mirror"))
@@ -667,6 +667,17 @@ struct remote *remote_get(const char *name)
        return ret;
 }
 
+int remote_is_configured(const char *name)
+{
+       int i;
+       read_config();
+
+       for (i = 0; i < remotes_nr; i++)
+               if (!strcmp(name, remotes[i]->name))
+                       return 1;
+       return 0;
+}
+
 int for_each_remote(each_remote_fn fn, void *priv)
 {
        int i, result = 0;
@@ -1170,8 +1181,9 @@ struct branch *branch_get(const char *name)
                        for (i = 0; i < ret->merge_nr; i++) {
                                ret->merge[i] = xcalloc(1, sizeof(**ret->merge));
                                ret->merge[i]->src = xstrdup(ret->merge_name[i]);
-                               remote_find_tracking(ret->remote,
-                                                    ret->merge[i]);
+                               if (remote_find_tracking(ret->remote, ret->merge[i])
+                                   && !strcmp(ret->remote_name, "."))
+                                       ret->merge[i]->dst = xstrdup(ret->merge_name[i]);
                        }
                }
        }
@@ -1401,10 +1413,9 @@ int stat_tracking_info(struct branch *branch, int *num_ours, int *num_theirs)
        if (theirs == ours)
                return 0;
 
-       /* Run "rev-list --no-merges --left-right ours...theirs" internally... */
+       /* Run "rev-list --left-right ours...theirs" internally... */
        rev_argc = 0;
        rev_argv[rev_argc++] = NULL;
-       rev_argv[rev_argc++] = "--no-merges";
        rev_argv[rev_argc++] = "--left-right";
        rev_argv[rev_argc++] = symmetric;
        rev_argv[rev_argc++] = "--";
@@ -1449,9 +1460,7 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)
                return 0;
 
        base = branch->merge[0]->dst;
-       if (!prefixcmp(base, "refs/remotes/")) {
-               base += strlen("refs/remotes/");
-       }
+       base = shorten_unambiguous_ref(base, 0);
        if (!num_theirs)
                strbuf_addf(sb, "Your branch is ahead of '%s' "
                            "by %d commit%s.\n",
@@ -1490,7 +1499,7 @@ static int one_local_ref(const char *refname, const unsigned char *sha1, int fla
 
 struct ref *get_local_heads(void)
 {
-       struct ref *local_refs, **local_tail = &local_refs;
+       struct ref *local_refs = NULL, **local_tail = &local_refs;
        for_each_ref(one_local_ref, &local_tail);
        return local_refs;
 }