}
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"))
static struct ref *get_local_ref(const char *name)
{
- if (!name)
+ if (!name || name[0] == '\0')
return NULL;
if (!prefixcmp(name, "refs/"))
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++] = "--";
return 0;
base = branch->merge[0]->dst;
- if (!prefixcmp(base, "refs/remotes/")) {
- base += strlen("refs/remotes/");
- } else if (!prefixcmp(base, "refs/heads/")) {
- base += strlen("refs/heads/");
- }
+ base = shorten_unambiguous_ref(base, 0);
if (!num_theirs)
strbuf_addf(sb, "Your branch is ahead of '%s' "
"by %d commit%s.\n",
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;
}