From 674468b3642abfff7c61d5ff95fffc43b87f70b7 Mon Sep 17 00:00:00 2001 From: Thomas Gummerer Date: Tue, 16 Feb 2016 10:47:50 +0100 Subject: remote: simplify remote_is_configured() The remote_is_configured() function allows checking whether a remote exists or not. The function however only works if remote_get() wasn't called before calling it. In addition, it only checks the configuration for remotes, but not remotes or branches files. Make use of the origin member of struct remote instead, which indicates where the remote comes from. It will be set to some value if the remote is configured in any file in the repository, but is initialized to 0 if the remote is only created in make_remote(). Signed-off-by: Thomas Gummerer Reviewed-by: Jeff King Signed-off-by: Junio C Hamano --- builtin/fetch.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'builtin/fetch.c') diff --git a/builtin/fetch.c b/builtin/fetch.c index 8e742135f0..81218300d8 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1016,10 +1016,9 @@ static int add_remote_or_group(const char *name, struct string_list *list) git_config(get_remote_group, &g); if (list->nr == prev_nr) { - struct remote *remote; - if (!remote_is_configured(name)) + struct remote *remote = remote_get(name); + if (!remote_is_configured(remote)) return 0; - remote = remote_get(name); string_list_append(list, remote->name); } return 1; -- cgit v1.2.1