{"thread":{"id":"20385","subject":"[PATCH 04/13] Use a function to determine whether a remote is valid","startedAt":"2009-08-05T05:02:01Z","lastAt":"2009-08-05T05:02:01Z","messageCount":1,"participants":["Daniel Barkalow"],"isPatch":true,"patchVersion":1,"patchTotal":13},"messages":[{"id":"119565","messageId":"alpine.LNX.2.00.0908050055240.2147@iabervon.org","threadId":"20385","inReplyTo":null,"subject":"[PATCH 04/13] Use a function to determine whether a remote is valid","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2009-08-05T05:02:01Z","receivedAt":"2009-08-05T05:02:01Z","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 c3ada2d..e6f5cd2 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.rc3.27.g95032.dirty\n"}]}