summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorDaniel Barkalow <barkalow@iabervon.org>2009-11-18 02:42:23 +0100
committerJunio C Hamano <gitster@pobox.com>2009-11-17 21:45:44 -0800
commit0a4da29dd806bca41cc615961d034b5a5fc30ff7 (patch)
treedb56a1ee173bc91804bb8f572547004538aee6a7 /remote.c
parentfb0cc87ec0f1e9c13b27ea2c89127991d44ed3d3 (diff)
downloadgit-0a4da29dd806bca41cc615961d034b5a5fc30ff7.tar.gz
Use a function to determine whether a remote is valid
Currently, it only checks url, but it will allow other things in the future. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/remote.c b/remote.c
index 73d33f2584..15c9cec60b 100644
--- a/remote.c
+++ b/remote.c
@@ -52,6 +52,11 @@ static struct rewrites rewrites_push;
#define BUF_SIZE (2048)
static char buffer[BUF_SIZE];
+static int valid_remote(const struct remote *remote)
+{
+ return !!remote->url;
+}
+
static const char *alias_url(const char *url, struct rewrites *r)
{
int i, j;
@@ -688,14 +693,14 @@ struct remote *remote_get(const char *name)
ret = make_remote(name, 0);
if (valid_remote_nick(name)) {
- if (!ret->url)
+ if (!valid_remote(ret))
read_remotes_file(ret);
- if (!ret->url)
+ if (!valid_remote(ret))
read_branches_file(ret);
}
- if (name_given && !ret->url)
+ if (name_given && !valid_remote(ret))
add_url_alias(ret, name);
- if (!ret->url)
+ if (!valid_remote(ret))
return NULL;
ret->fetch = parse_fetch_refspec(ret->fetch_refspec_nr, ret->fetch_refspec);
ret->push = parse_push_refspec(ret->push_refspec_nr, ret->push_refspec);