summaryrefslogtreecommitdiff
path: root/builtin-remote.c
diff options
context:
space:
mode:
authorJay Soffian <jaysoffian@gmail.com>2009-02-25 03:32:22 -0500
committerJunio C Hamano <gitster@pobox.com>2009-02-27 15:19:09 -0800
commitcca7c97e37719eaee1d31cdaf1e638d19ecd69e4 (patch)
tree899c91193958cc05556397e2869e07b869d289de /builtin-remote.c
parente0cc81e63c7bb603545c90e47d4c6398f6347dfb (diff)
downloadgit-cca7c97e37719eaee1d31cdaf1e638d19ecd69e4.tar.gz
builtin-remote: make get_remote_ref_states() always populate states.tracked
When not querying the remote, show() was having to populate states.tracked itself. It makes more sense for get_remote_ref_states() to do this consistently. Since show() is the only caller of get_remote_ref_states() with query=0, this change does not affect other callers. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-remote.c')
-rw-r--r--builtin-remote.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/builtin-remote.c b/builtin-remote.c
index fc02e5f34b..1b5e8b6811 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -632,6 +632,20 @@ static void free_remote_ref_states(struct ref_states *states)
string_list_clear(&states->tracked, 0);
}
+static int append_ref_to_tracked_list(const char *refname,
+ const unsigned char *sha1, int flags, void *cb_data)
+{
+ struct ref_states *states = cb_data;
+ struct refspec refspec;
+
+ memset(&refspec, 0, sizeof(refspec));
+ refspec.dst = (char *)refname;
+ if (!remote_find_tracking(states->remote, &refspec))
+ string_list_append(abbrev_branch(refspec.src), &states->tracked);
+
+ return 0;
+}
+
static int get_remote_ref_states(const char *name,
struct ref_states *states,
int query)
@@ -652,21 +666,8 @@ static int get_remote_ref_states(const char *name,
transport_disconnect(transport);
get_ref_states(remote_refs, states);
- }
-
- return 0;
-}
-
-static int append_ref_to_tracked_list(const char *refname,
- const unsigned char *sha1, int flags, void *cb_data)
-{
- struct ref_states *states = cb_data;
- struct refspec refspec;
-
- memset(&refspec, 0, sizeof(refspec));
- refspec.dst = (char *)refname;
- if (!remote_find_tracking(states->remote, &refspec))
- string_list_append(abbrev_branch(refspec.src), &states->tracked);
+ } else
+ for_each_ref(append_ref_to_tracked_list, states);
return 0;
}
@@ -720,8 +721,6 @@ static int show(int argc, const char **argv)
"prune')", &states.stale, "");
}
- if (no_query)
- for_each_ref(append_ref_to_tracked_list, &states);
show_list(" Tracked remote branch%s", &states.tracked, "");
if (states.remote->push_refspec_nr) {