{"thread":{"id":"9935","subject":"[PATCH 1/5] Rename remote.uri to remote.url within remote handling internals","startedAt":"2007-09-19T04:49:27Z","lastAt":"2007-09-19T04:49:27Z","messageCount":1,"participants":["Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"53545","messageId":"20070919044927.GA17107@spearce.org","threadId":"9935","inReplyTo":null,"subject":"[PATCH 1/5] Rename remote.uri to remote.url within remote handling internals","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-09-19T04:49:27Z","receivedAt":"2007-09-19T04:49:27Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Anyplace we talk about the address of a remote repository we always\nrefer to it as a URL, especially in the configuration file and\n.git/remotes where we call it \"remote.$n.url\" or start the first\nline with \"URL:\".  Calling this value a uri within the internal C\ncode just doesn't jive well with our commonly accepted terms.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n builtin-fetch.c |    2 +-\n builtin-push.c  |    8 ++++----\n remote.c        |   34 +++++++++++++++++-----------------\n remote.h        |    6 +++---\n send-pack.c     |    2 +-\n 5 files changed, 26 insertions(+), 26 deletions(-)\n\ndiff --git a/builtin-fetch.c b/builtin-fetch.c\nindex b9722e5..997a8ff 100644\n--- a/builtin-fetch.c\n+++ b/builtin-fetch.c\n@@ -530,7 +530,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)\n \telse\n \t\tremote = remote_get(argv[i++]);\n \n-\ttransport = transport_get(remote, remote->uri[0]);\n+\ttransport = transport_get(remote, remote->url[0]);\n \tif (verbose >= 2)\n \t\ttransport->verbose = 1;\n \tif (quiet)\ndiff --git a/builtin-push.c b/builtin-push.c\nindex 7d7e826..4ee36c2 100644\n--- a/builtin-push.c\n+++ b/builtin-push.c\n@@ -57,9 +57,9 @@ static int do_push(const char *repo, int flags)\n \t\trefspec_nr = remote->push_refspec_nr;\n \t}\n \terrs = 0;\n-\tfor (i = 0; i < remote->uri_nr; i++) {\n+\tfor (i = 0; i < remote->url_nr; i++) {\n \t\tstruct transport *transport =\n-\t\t\ttransport_get(remote, remote->uri[i]);\n+\t\t\ttransport_get(remote, remote->url[i]);\n \t\tint err;\n \t\tif (receivepack)\n \t\t\ttransport_set_option(transport,\n@@ -68,14 +68,14 @@ static int do_push(const char *repo, int flags)\n \t\t\ttransport_set_option(transport, TRANS_OPT_THIN, \"yes\");\n \n \t\tif (verbose)\n-\t\t\tfprintf(stderr, \"Pushing to %s\\n\", remote->uri[i]);\n+\t\t\tfprintf(stderr, \"Pushing to %s\\n\", remote->url[i]);\n \t\terr = transport_push(transport, refspec_nr, refspec, flags);\n \t\terr |= transport_disconnect(transport);\n \n \t\tif (!err)\n \t\t\tcontinue;\n \n-\t\terror(\"failed to push to '%s'\", remote->uri[i]);\n+\t\terror(\"failed to push to '%s'\", remote->url[i]);\n \t\terrs++;\n \t}\n \treturn !!errs;\ndiff --git a/remote.c b/remote.c\nindex 31e2b70..e3c3df5 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -32,13 +32,13 @@ static void add_fetch_refspec(struct remote *remote, const char *ref)\n \tremote->fetch_refspec_nr = nr;\n }\n \n-static void add_uri(struct remote *remote, const char *uri)\n+static void add_url(struct remote *remote, const char *url)\n {\n-\tint nr = remote->uri_nr + 1;\n-\tremote->uri =\n-\t\txrealloc(remote->uri, nr * sizeof(char *));\n-\tremote->uri[nr-1] = uri;\n-\tremote->uri_nr = nr;\n+\tint nr = remote->url_nr + 1;\n+\tremote->url =\n+\t\txrealloc(remote->url, nr * sizeof(char *));\n+\tremote->url[nr-1] = url;\n+\tremote->url_nr = nr;\n }\n \n static struct remote *make_remote(const char *name, int len)\n@@ -154,7 +154,7 @@ static void read_remotes_file(struct remote *remote)\n \n \t\tswitch (value_list) {\n \t\tcase 0:\n-\t\t\tadd_uri(remote, xstrdup(s));\n+\t\t\tadd_url(remote, xstrdup(s));\n \t\t\tbreak;\n \t\tcase 1:\n \t\t\tadd_push_refspec(remote, xstrdup(s));\n@@ -206,7 +206,7 @@ static void read_branches_file(struct remote *remote)\n \t} else {\n \t\tbranch = \"refs/heads/master\";\n \t}\n-\tadd_uri(remote, p);\n+\tadd_url(remote, p);\n \tadd_fetch_refspec(remote, branch);\n \tremote->fetch_tags = 1; /* always auto-follow */\n }\n@@ -260,7 +260,7 @@ static int handle_config(const char *key, const char *value)\n \t\treturn 0; /* ignore unknown booleans */\n \t}\n \tif (!strcmp(subkey, \".url\")) {\n-\t\tadd_uri(remote, xstrdup(value));\n+\t\tadd_url(remote, xstrdup(value));\n \t} else if (!strcmp(subkey, \".push\")) {\n \t\tadd_push_refspec(remote, xstrdup(value));\n \t} else if (!strcmp(subkey, \".fetch\")) {\n@@ -347,14 +347,14 @@ struct remote *remote_get(const char *name)\n \t\tname = default_remote_name;\n \tret = make_remote(name, 0);\n \tif (name[0] != '/') {\n-\t\tif (!ret->uri)\n+\t\tif (!ret->url)\n \t\t\tread_remotes_file(ret);\n-\t\tif (!ret->uri)\n+\t\tif (!ret->url)\n \t\t\tread_branches_file(ret);\n \t}\n-\tif (!ret->uri)\n-\t\tadd_uri(ret, name);\n-\tif (!ret->uri)\n+\tif (!ret->url)\n+\t\tadd_url(ret, name);\n+\tif (!ret->url)\n \t\treturn NULL;\n \tret->fetch = parse_ref_spec(ret->fetch_refspec_nr, ret->fetch_refspec);\n \tret->push = parse_ref_spec(ret->push_refspec_nr, ret->push_refspec);\n@@ -380,11 +380,11 @@ int for_each_remote(each_remote_fn fn, void *priv)\n \treturn result;\n }\n \n-int remote_has_uri(struct remote *remote, const char *uri)\n+int remote_has_url(struct remote *remote, const char *url)\n {\n \tint i;\n-\tfor (i = 0; i < remote->uri_nr; i++) {\n-\t\tif (!strcmp(remote->uri[i], uri))\n+\tfor (i = 0; i < remote->url_nr; i++) {\n+\t\tif (!strcmp(remote->url[i], url))\n \t\t\treturn 1;\n \t}\n \treturn 0;\ndiff --git a/remote.h b/remote.h\nindex b5b558f..05add06 100644\n--- a/remote.h\n+++ b/remote.h\n@@ -4,8 +4,8 @@\n struct remote {\n \tconst char *name;\n \n-\tconst char **uri;\n-\tint uri_nr;\n+\tconst char **url;\n+\tint url_nr;\n \n \tconst char **push_refspec;\n \tstruct refspec *push;\n@@ -32,7 +32,7 @@ struct remote *remote_get(const char *name);\n typedef int each_remote_fn(struct remote *remote, void *priv);\n int for_each_remote(each_remote_fn fn, void *priv);\n \n-int remote_has_uri(struct remote *remote, const char *uri);\n+int remote_has_url(struct remote *remote, const char *url);\n \n struct refspec {\n \tunsigned force : 1;\ndiff --git a/send-pack.c b/send-pack.c\nindex f74e66a..4533d1b 100644\n--- a/send-pack.c\n+++ b/send-pack.c\n@@ -420,7 +420,7 @@ int main(int argc, char **argv)\n \n \tif (remote_name) {\n \t\tremote = remote_get(remote_name);\n-\t\tif (!remote_has_uri(remote, dest)) {\n+\t\tif (!remote_has_url(remote, dest)) {\n \t\t\tdie(\"Destination %s is not a uri for %s\",\n \t\t\t    dest, remote_name);\n \t\t}\n-- \n1.5.3.1.195.gadd6\n"}]}