{"thread":{"id":"20841","subject":"[PATCH 3/8] Use a function to determine whether a remote is valid","startedAt":"2009-09-04T02:13:53Z","lastAt":"2009-09-04T02:13:53Z","messageCount":1,"participants":["Daniel Barkalow"],"isPatch":true,"patchVersion":1,"patchTotal":8},"messages":[{"id":"122379","messageId":"alpine.LNX.2.00.0909032213230.28290@iabervon.org","threadId":"20841","inReplyTo":null,"subject":"[PATCH 3/8] Use a function to determine whether a remote is valid","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2009-09-04T02:13:53Z","receivedAt":"2009-09-04T02:13:53Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"Currently, it only checks url, but it will allow other things in the future.\n\nSigned-off-by: Daniel Barkalow <barkalow@iabervon.org>\n---\n remote.c |   13 +++++++++----\n 1 files changed, 9 insertions(+), 4 deletions(-)\n\ndiff --git a/remote.c b/remote.c\nindex 4b5b905..fec63fa 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -48,6 +48,11 @@ static int rewrite_nr;\n #define BUF_SIZE (2048)\n static char buffer[BUF_SIZE];\n \n+static int valid_remote(const struct remote *remote)\n+{\n+\treturn !!remote->url;\n+}\n+\n static const char *alias_url(const char *url)\n {\n \tint i, j;\n@@ -667,14 +672,14 @@ struct remote *remote_get(const char *name)\n \n \tret = make_remote(name, 0);\n \tif (valid_remote_nick(name)) {\n-\t\tif (!ret->url)\n+\t\tif (!valid_remote(ret))\n \t\t\tread_remotes_file(ret);\n-\t\tif (!ret->url)\n+\t\tif (!valid_remote(ret))\n \t\t\tread_branches_file(ret);\n \t}\n-\tif (name_given && !ret->url)\n+\tif (name_given && !valid_remote(ret))\n \t\tadd_url_alias(ret, name);\n-\tif (!ret->url)\n+\tif (!valid_remote(ret))\n \t\treturn NULL;\n \tret->fetch = parse_fetch_refspec(ret->fetch_refspec_nr, ret->fetch_refspec);\n \tret->push = parse_push_refspec(ret->push_refspec_nr, ret->push_refspec);\n-- \n1.6.4.2.419.gc86f8\n"}]}