summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fa685bd)
raw | patch | inline | side by side (parent: fa685bd)
author | Junio C Hamano <gitster@pobox.com> | |
Mon, 16 Mar 2009 07:35:09 +0000 (00:35 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 16 Mar 2009 07:35:09 +0000 (00:35 -0700) |
The config file is not the only place remotes are defined, and without
consulting .git/remotes and .git/branches, you won't know if "origin" is
configured by the user. Don't give up too early and insult the user with
a wisecrack "Where do you want to fetch from today?"
The only thing the previous patch seems to want to prevent from happening
is a lazy "git fetch/push" that does not say where-from/to to produce an
error message 'origin not found', and we can do that by not letting
add_url_alias() to turn a nickname "origin" literally into a pathname
"origin" without changing the rest of the logic.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
consulting .git/remotes and .git/branches, you won't know if "origin" is
configured by the user. Don't give up too early and insult the user with
a wisecrack "Where do you want to fetch from today?"
The only thing the previous patch seems to want to prevent from happening
is a lazy "git fetch/push" that does not say where-from/to to produce an
error message 'origin not found', and we can do that by not letting
add_url_alias() to turn a nickname "origin" literally into a pathname
"origin" without changing the rest of the logic.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
remote.c | patch | blob | history |
diff --git a/remote.c b/remote.c
index 199830ea93f6f87cd3764afe1880e968209439c7..c7a8c2b1fbdea9aa03d8a5ccd8cbfb39eed742df 100644 (file)
--- a/remote.c
+++ b/remote.c
add_url(remote, alias_url(url));
}
-static struct remote *get_remote_by_name(const char *name)
-{
- int i;
- for (i = 0; i < remotes_nr; i++) {
- if (!strcmp(name, remotes[i]->name))
- return remotes[i];
- }
- return NULL;
-}
-
static struct remote *make_remote(const char *name, int len)
{
struct remote *ret;
name = default_remote_name;
name_given = explicit_default_remote_name;
}
- if (name_given)
- ret = make_remote(name, 0);
- else {
- ret = get_remote_by_name(name);
- if (!ret)
- return NULL;
- }
+
+ ret = make_remote(name, 0);
if (valid_remote_nick(name)) {
if (!ret->url)
read_remotes_file(ret);
if (!ret->url)
read_branches_file(ret);
}
- if (!ret->url)
+ if (name_given && !ret->url)
add_url_alias(ret, name);
if (!ret->url)
return NULL;