Rename remote.uri to remote.url within remote handling internals

Anyplace we talk about the address of a remote repository we always
refer to it as a URL, especially in the configuration file and
.git/remotes where we call it "remote.$n.url" or start the first
line with "URL:".  Calling this value a uri within the internal C
code just doesn't jive well with our commonly accepted terms.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Shawn O. Pearce 2007-09-19 00:49:27 -04:00 committed by Junio C Hamano
parent bbaf458428
commit 28b91f8ad9
5 changed files with 26 additions and 26 deletions

View File

@ -530,7 +530,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
else else
remote = remote_get(argv[i++]); remote = remote_get(argv[i++]);
transport = transport_get(remote, remote->uri[0]); transport = transport_get(remote, remote->url[0]);
if (verbose >= 2) if (verbose >= 2)
transport->verbose = 1; transport->verbose = 1;
if (quiet) if (quiet)

View File

@ -57,9 +57,9 @@ static int do_push(const char *repo, int flags)
refspec_nr = remote->push_refspec_nr; refspec_nr = remote->push_refspec_nr;
} }
errs = 0; errs = 0;
for (i = 0; i < remote->uri_nr; i++) { for (i = 0; i < remote->url_nr; i++) {
struct transport *transport = struct transport *transport =
transport_get(remote, remote->uri[i]); transport_get(remote, remote->url[i]);
int err; int err;
if (receivepack) if (receivepack)
transport_set_option(transport, transport_set_option(transport,
@ -68,14 +68,14 @@ static int do_push(const char *repo, int flags)
transport_set_option(transport, TRANS_OPT_THIN, "yes"); transport_set_option(transport, TRANS_OPT_THIN, "yes");
if (verbose) if (verbose)
fprintf(stderr, "Pushing to %s\n", remote->uri[i]); fprintf(stderr, "Pushing to %s\n", remote->url[i]);
err = transport_push(transport, refspec_nr, refspec, flags); err = transport_push(transport, refspec_nr, refspec, flags);
err |= transport_disconnect(transport); err |= transport_disconnect(transport);
if (!err) if (!err)
continue; continue;
error("failed to push to '%s'", remote->uri[i]); error("failed to push to '%s'", remote->url[i]);
errs++; errs++;
} }
return !!errs; return !!errs;

View File

@ -32,13 +32,13 @@ static void add_fetch_refspec(struct remote *remote, const char *ref)
remote->fetch_refspec_nr = nr; remote->fetch_refspec_nr = nr;
} }
static void add_uri(struct remote *remote, const char *uri) static void add_url(struct remote *remote, const char *url)
{ {
int nr = remote->uri_nr + 1; int nr = remote->url_nr + 1;
remote->uri = remote->url =
xrealloc(remote->uri, nr * sizeof(char *)); xrealloc(remote->url, nr * sizeof(char *));
remote->uri[nr-1] = uri; remote->url[nr-1] = url;
remote->uri_nr = nr; remote->url_nr = nr;
} }
static struct remote *make_remote(const char *name, int len) static struct remote *make_remote(const char *name, int len)
@ -154,7 +154,7 @@ static void read_remotes_file(struct remote *remote)
switch (value_list) { switch (value_list) {
case 0: case 0:
add_uri(remote, xstrdup(s)); add_url(remote, xstrdup(s));
break; break;
case 1: case 1:
add_push_refspec(remote, xstrdup(s)); add_push_refspec(remote, xstrdup(s));
@ -206,7 +206,7 @@ static void read_branches_file(struct remote *remote)
} else { } else {
branch = "refs/heads/master"; branch = "refs/heads/master";
} }
add_uri(remote, p); add_url(remote, p);
add_fetch_refspec(remote, branch); add_fetch_refspec(remote, branch);
remote->fetch_tags = 1; /* always auto-follow */ remote->fetch_tags = 1; /* always auto-follow */
} }
@ -260,7 +260,7 @@ static int handle_config(const char *key, const char *value)
return 0; /* ignore unknown booleans */ return 0; /* ignore unknown booleans */
} }
if (!strcmp(subkey, ".url")) { if (!strcmp(subkey, ".url")) {
add_uri(remote, xstrdup(value)); add_url(remote, xstrdup(value));
} else if (!strcmp(subkey, ".push")) { } else if (!strcmp(subkey, ".push")) {
add_push_refspec(remote, xstrdup(value)); add_push_refspec(remote, xstrdup(value));
} else if (!strcmp(subkey, ".fetch")) { } else if (!strcmp(subkey, ".fetch")) {
@ -347,14 +347,14 @@ struct remote *remote_get(const char *name)
name = default_remote_name; name = default_remote_name;
ret = make_remote(name, 0); ret = make_remote(name, 0);
if (name[0] != '/') { if (name[0] != '/') {
if (!ret->uri) if (!ret->url)
read_remotes_file(ret); read_remotes_file(ret);
if (!ret->uri) if (!ret->url)
read_branches_file(ret); read_branches_file(ret);
} }
if (!ret->uri) if (!ret->url)
add_uri(ret, name); add_url(ret, name);
if (!ret->uri) if (!ret->url)
return NULL; return NULL;
ret->fetch = parse_ref_spec(ret->fetch_refspec_nr, ret->fetch_refspec); ret->fetch = parse_ref_spec(ret->fetch_refspec_nr, ret->fetch_refspec);
ret->push = parse_ref_spec(ret->push_refspec_nr, ret->push_refspec); ret->push = parse_ref_spec(ret->push_refspec_nr, ret->push_refspec);
@ -380,11 +380,11 @@ int for_each_remote(each_remote_fn fn, void *priv)
return result; return result;
} }
int remote_has_uri(struct remote *remote, const char *uri) int remote_has_url(struct remote *remote, const char *url)
{ {
int i; int i;
for (i = 0; i < remote->uri_nr; i++) { for (i = 0; i < remote->url_nr; i++) {
if (!strcmp(remote->uri[i], uri)) if (!strcmp(remote->url[i], url))
return 1; return 1;
} }
return 0; return 0;

View File

@ -4,8 +4,8 @@
struct remote { struct remote {
const char *name; const char *name;
const char **uri; const char **url;
int uri_nr; int url_nr;
const char **push_refspec; const char **push_refspec;
struct refspec *push; struct refspec *push;
@ -32,7 +32,7 @@ struct remote *remote_get(const char *name);
typedef int each_remote_fn(struct remote *remote, void *priv); typedef int each_remote_fn(struct remote *remote, void *priv);
int for_each_remote(each_remote_fn fn, void *priv); int for_each_remote(each_remote_fn fn, void *priv);
int remote_has_uri(struct remote *remote, const char *uri); int remote_has_url(struct remote *remote, const char *url);
struct refspec { struct refspec {
unsigned force : 1; unsigned force : 1;

View File

@ -420,7 +420,7 @@ int main(int argc, char **argv)
if (remote_name) { if (remote_name) {
remote = remote_get(remote_name); remote = remote_get(remote_name);
if (!remote_has_uri(remote, dest)) { if (!remote_has_url(remote, dest)) {
die("Destination %s is not a uri for %s", die("Destination %s is not a uri for %s",
dest, remote_name); dest, remote_name);
} }