Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
builtin-remote: rename variables and eliminate redundant function call
author
Jay Soffian
<jaysoffian@gmail.com>
Wed, 25 Feb 2009 08:32:21 +0000
(
03:32
-0500)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 27 Feb 2009 23:19:08 +0000
(15:19 -0800)
- The variable name "remote" is used as both a "char *" and as a "struct
remote *"; this is confusing, so rename the former to remote_name.
- Consistently refer to the refs returned by transport_get_remote_refs()
as remote_refs.
- There is no need to call "sort_string_list(&branch_list)" as
branch_list is populated via string_list_insert(), which maintains its
order.
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-remote.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
7b9a5e2
)
diff --git
a/builtin-remote.c
b/builtin-remote.c
index 3e6dee4ad5ca90c5d075fcb9509536cd2d0b0364..fc02e5f34bf28fc1d7b45ba67cc4499646159874 100644
(file)
--- a/
builtin-remote.c
+++ b/
builtin-remote.c
@@
-143,7
+143,7
@@
static int add(int argc, const char **argv)
}
struct branch_info {
}
struct branch_info {
- char *remote;
+ char *remote
_name
;
struct string_list merge;
};
struct string_list merge;
};
@@
-182,9
+182,9
@@
static int config_read_branches(const char *key, const char *value, void *cb)
item->util = xcalloc(sizeof(struct branch_info), 1);
info = item->util;
if (type == REMOTE) {
item->util = xcalloc(sizeof(struct branch_info), 1);
info = item->util;
if (type == REMOTE) {
- if (info->remote)
+ if (info->remote
_name
)
warning("more than one branch.%s", key);
warning("more than one branch.%s", key);
- info->remote = xstrdup(value);
+ info->remote
_name
= xstrdup(value);
} else {
char *space = strchr(value, ' ');
value = abbrev_branch(value);
} else {
char *space = strchr(value, ' ');
value = abbrev_branch(value);
@@
-206,7
+206,6
@@
static void read_branches(void)
if (branch_list.nr)
return;
git_config(config_read_branches, NULL);
if (branch_list.nr)
return;
git_config(config_read_branches, NULL);
- sort_string_list(&branch_list);
}
struct ref_states {
}
struct ref_states {
@@
-238,13
+237,14
@@
static int handle_one_branch(const char *refname,
return 0;
}
return 0;
}
-static int get_ref_states(const struct ref *re
f
, struct ref_states *states)
+static int get_ref_states(const struct ref *re
mote_refs
, struct ref_states *states)
{
struct ref *fetch_map = NULL, **tail = &fetch_map;
{
struct ref *fetch_map = NULL, **tail = &fetch_map;
+ struct ref *ref;
int i;
for (i = 0; i < states->remote->fetch_refspec_nr; i++)
int i;
for (i = 0; i < states->remote->fetch_refspec_nr; i++)
- if (get_fetch_map(re
f
, states->remote->fetch + i, &tail, 1))
+ if (get_fetch_map(re
mote_refs
, states->remote->fetch + i, &tail, 1))
die("Could not get fetch map for refspec %s",
states->remote->fetch_refspec[i]);
die("Could not get fetch map for refspec %s",
states->remote->fetch_refspec[i]);
@@
-459,7
+459,7
@@
static int mv(int argc, const char **argv)
for (i = 0; i < branch_list.nr; i++) {
struct string_list_item *item = branch_list.items + i;
struct branch_info *info = item->util;
for (i = 0; i < branch_list.nr; i++) {
struct string_list_item *item = branch_list.items + i;
struct branch_info *info = item->util;
- if (info->remote
&& !strcmp(info->remot
e, rename.old)) {
+ if (info->remote
_name && !strcmp(info->remote_nam
e, rename.old)) {
strbuf_reset(&buf);
strbuf_addf(&buf, "branch.%s.remote", item->string);
if (git_config_set(buf.buf, rename.new)) {
strbuf_reset(&buf);
strbuf_addf(&buf, "branch.%s.remote", item->string);
if (git_config_set(buf.buf, rename.new)) {
@@
-569,7
+569,7
@@
static int rm(int argc, const char **argv)
for (i = 0; i < branch_list.nr; i++) {
struct string_list_item *item = branch_list.items + i;
struct branch_info *info = item->util;
for (i = 0; i < branch_list.nr; i++) {
struct string_list_item *item = branch_list.items + i;
struct branch_info *info = item->util;
- if (info->remote
&& !strcmp(info->remot
e, remote->name)) {
+ if (info->remote
_name && !strcmp(info->remote_nam
e, remote->name)) {
const char *keys[] = { "remote", "merge", NULL }, **k;
for (k = keys; *k; k++) {
strbuf_reset(&buf);
const char *keys[] = { "remote", "merge", NULL }, **k;
for (k = keys; *k; k++) {
strbuf_reset(&buf);
@@
-637,7
+637,7
@@
static int get_remote_ref_states(const char *name,
int query)
{
struct transport *transport;
int query)
{
struct transport *transport;
- const struct ref *re
f
;
+ const struct ref *re
mote_refs
;
states->remote = remote_get(name);
if (!states->remote)
states->remote = remote_get(name);
if (!states->remote)
@@
-648,10
+648,10
@@
static int get_remote_ref_states(const char *name,
if (query) {
transport = transport_get(NULL, states->remote->url_nr > 0 ?
states->remote->url[0] : NULL);
if (query) {
transport = transport_get(NULL, states->remote->url_nr > 0 ?
states->remote->url[0] : NULL);
- re
f
= transport_get_remote_refs(transport);
+ re
mote_refs
= transport_get_remote_refs(transport);
transport_disconnect(transport);
transport_disconnect(transport);
- get_ref_states(re
f
, states);
+ get_ref_states(re
mote_refs
, states);
}
return 0;
}
return 0;
@@
-701,7
+701,7
@@
static int show(int argc, const char **argv)
struct branch_info *info = branch->util;
int j;
struct branch_info *info = branch->util;
int j;
- if (!info->merge.nr || strcmp(*argv, info->remote))
+ if (!info->merge.nr || strcmp(*argv, info->remote
_name
))
continue;
printf(" Remote branch%s merged with 'git pull' "
"while on branch %s\n ",
continue;
printf(" Remote branch%s merged with 'git pull' "
"while on branch %s\n ",