summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bed5d42)
raw | patch | inline | side by side (parent: bed5d42)
author | Finn Arne Gangstad <finnag@pvv.org> | |
Mon, 6 Apr 2009 13:41:01 +0000 (15:41 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 8 Apr 2009 04:51:59 +0000 (21:51 -0700) |
Previously, there was no easy way to check for the existence of a
configured remote. remote_get for example would always create the remote
"on demand".
This new function returns 1 if the remote is configured, 0 otherwise.
Signed-off-by: Finn Arne Gangstad <finnag@pvv.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
configured remote. remote_get for example would always create the remote
"on demand".
This new function returns 1 if the remote is configured, 0 otherwise.
Signed-off-by: Finn Arne Gangstad <finnag@pvv.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
remote.c | patch | blob | history | |
remote.h | patch | blob | history |
diff --git a/remote.c b/remote.c
index 2b037f11b29d86e38d6608a58c65e79e0ffd3800..b36fd70978fdb1683ae3b2401822ef0130cd6ead 100644 (file)
--- a/remote.c
+++ b/remote.c
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;
diff --git a/remote.h b/remote.h
index de3d21b6626f64ffc54904eec6f26a614feab30a..99706a89bc6011c01fcd661d8bad4b26f59b0ca7 100644 (file)
--- a/remote.h
+++ b/remote.h
};
struct remote *remote_get(const char *name);
+int remote_is_configured(const char *name);
typedef int each_remote_fn(struct remote *remote, void *priv);
int for_each_remote(each_remote_fn fn, void *priv);