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>
Shawn O. Pearce committed
Sep 19, 2007 at 00:49 UTC
28b91f8ad9e4791b5c35ca6bffbb78725b4e5bbf
5 files changed
+26
-26
builtin-fetch.c
+1
-1
@@ -530,7 +530,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
530
else
531
remote = remote_get(argv[i++]);
532
533
- transport = transport_get(remote, remote->uri[0]);
533
+ transport = transport_get(remote, remote->url[0]);
534
if (verbose >= 2)
535
transport->verbose = 1;
536
if (quiet)
builtin-push.c
+4
-4
@@ -57,9 +57,9 @@ static int do_push(const char *repo, int flags)
57
refspec_nr = remote->push_refspec_nr;
58
}
59
errs = 0;
60
- for (i = 0; i < remote->uri_nr; i++) {
60
+ for (i = 0; i < remote->url_nr; i++) {
61
struct transport *transport =
62
- transport_get(remote, remote->uri[i]);
62
+ transport_get(remote, remote->url[i]);
63
int err;
64
if (receivepack)
65
transport_set_option(transport,
@@ -68,14 +68,14 @@ static int do_push(const char *repo, int flags)
68
transport_set_option(transport, TRANS_OPT_THIN, "yes");
69
70
if (verbose)
71
- fprintf(stderr, "Pushing to %s\n", remote->uri[i]);
71
+ fprintf(stderr, "Pushing to %s\n", remote->url[i]);
72
err = transport_push(transport, refspec_nr, refspec, flags);
73
err |= transport_disconnect(transport);
74
75
if (!err)
76
continue;
77
78
- error("failed to push to '%s'", remote->uri[i]);
78
+ error("failed to push to '%s'", remote->url[i]);
79
errs++;
80
}
81
return !!errs;
remote.c
+17
-17
@@ -32,13 +32,13 @@ static void add_fetch_refspec(struct remote *remote, const char *ref)
32
remote->fetch_refspec_nr = nr;
33
}
34
35
-static void add_uri(struct remote *remote, const char *uri)
35
+static void add_url(struct remote *remote, const char *url)
36
{
37
- int nr = remote->uri_nr + 1;
38
- remote->uri =
39
- xrealloc(remote->uri, nr * sizeof(char *));
40
- remote->uri[nr-1] = uri;
41
- remote->uri_nr = nr;
37
+ int nr = remote->url_nr + 1;
38
+ remote->url =
39
+ xrealloc(remote->url, nr * sizeof(char *));
40
+ remote->url[nr-1] = url;
41
+ remote->url_nr = nr;
42
}
43
44
static struct remote *make_remote(const char *name, int len)
@@ -154,7 +154,7 @@ static void read_remotes_file(struct remote *remote)
154
155
switch (value_list) {
156
case 0:
157
- add_uri(remote, xstrdup(s));
157
+ add_url(remote, xstrdup(s));
158
break;
159
case 1:
160
add_push_refspec(remote, xstrdup(s));
@@ -206,7 +206,7 @@ static void read_branches_file(struct remote *remote)
206
} else {
207
branch = "refs/heads/master";
208
}
209
- add_uri(remote, p);
209
+ add_url(remote, p);
210
add_fetch_refspec(remote, branch);
211
remote->fetch_tags = 1; /* always auto-follow */
212
}
@@ -260,7 +260,7 @@ static int handle_config(const char *key, const char *value)
260
return 0; /* ignore unknown booleans */
261
}
262
if (!strcmp(subkey, ".url")) {
263
- add_uri(remote, xstrdup(value));
263
+ add_url(remote, xstrdup(value));
264
} else if (!strcmp(subkey, ".push")) {
265
add_push_refspec(remote, xstrdup(value));
266
} else if (!strcmp(subkey, ".fetch")) {
@@ -347,14 +347,14 @@ struct remote *remote_get(const char *name)
347
name = default_remote_name;
348
ret = make_remote(name, 0);
349
if (name[0] != '/') {
350
- if (!ret->uri)
350
+ if (!ret->url)
351
read_remotes_file(ret);
352
- if (!ret->uri)
352
+ if (!ret->url)
353
read_branches_file(ret);
354
}
355
- if (!ret->uri)
356
- add_uri(ret, name);
357
- if (!ret->uri)
355
+ if (!ret->url)
356
+ add_url(ret, name);
357
+ if (!ret->url)
358
return NULL;
359
ret->fetch = parse_ref_spec(ret->fetch_refspec_nr, ret->fetch_refspec);
360
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)
380
return result;
381
}
382
383
-int remote_has_uri(struct remote *remote, const char *uri)
383
+int remote_has_url(struct remote *remote, const char *url)
384
{
385
int i;
386
- for (i = 0; i < remote->uri_nr; i++) {
387
- if (!strcmp(remote->uri[i], uri))
386
+ for (i = 0; i < remote->url_nr; i++) {
387
+ if (!strcmp(remote->url[i], url))
388
return 1;
389
}
390
return 0;
remote.h
+3
-3
@@ -4,8 +4,8 @@
4
struct remote {
5
const char *name;
6
7
- const char **uri;
8
- int uri_nr;
7
+ const char **url;
8
+ int url_nr;
9
10
const char **push_refspec;
11
struct refspec *push;
@@ -32,7 +32,7 @@ struct remote *remote_get(const char *name);
32
typedef int each_remote_fn(struct remote *remote, void *priv);
33
int for_each_remote(each_remote_fn fn, void *priv);
34
35
-int remote_has_uri(struct remote *remote, const char *uri);
35
+int remote_has_url(struct remote *remote, const char *url);
36
37
struct refspec {
38
unsigned force : 1;
send-pack.c
+1
-1
@@ -420,7 +420,7 @@ int main(int argc, char **argv)
420
421
if (remote_name) {
422
remote = remote_get(remote_name);
423
- if (!remote_has_uri(remote, dest)) {
423
+ if (!remote_has_url(remote, dest)) {
424
die("Destination %s is not a uri for %s",
425
dest, remote_name);
426
}