Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Soffian <jaysoffian@gmail.com>2009-02-25 11:32:23 +0300
committerJunio C Hamano <gitster@pobox.com>2009-02-28 02:19:09 +0300
commit3bd925636cd11400d1840b39d0d18b640f32bdd2 (patch)
treeeee7e3bc66561b3eae45e9441fdf7a51c9a8b48e /builtin-remote.c
parentcca7c97e37719eaee1d31cdaf1e638d19ecd69e4 (diff)
builtin-remote: fix two inconsistencies in the output of "show <remote>"
Remote and stale branches are emitted in alphabetical order, but new and tracked branches are not. So sort the latter to be consistent with the former. This also lets us use more efficient string_list_has_string() instead of unsorted_string_list_has_string(). "show <remote>" prunes symrefs, but "show <remote> -n" does not. Fix the latter to match the former. 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.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/builtin-remote.c b/builtin-remote.c
index 1b5e8b6811..963be6df95 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -226,10 +226,8 @@ static int handle_one_branch(const char *refname,
const char *name = abbrev_branch(refspec.src);
/* symbolic refs pointing nowhere were handled already */
if ((flags & REF_ISSYMREF) ||
- unsorted_string_list_has_string(&states->tracked,
- name) ||
- unsorted_string_list_has_string(&states->new,
- name))
+ string_list_has_string(&states->tracked, name) ||
+ string_list_has_string(&states->new, name))
return 0;
item = string_list_append(name, &states->stale);
item->util = xstrdup(refname);
@@ -258,6 +256,8 @@ static int get_ref_states(const struct ref *remote_refs, struct ref_states *stat
}
free_refs(fetch_map);
+ sort_string_list(&states->new);
+ sort_string_list(&states->tracked);
for_each_ref(handle_one_branch, states);
sort_string_list(&states->stale);
@@ -638,6 +638,9 @@ static int append_ref_to_tracked_list(const char *refname,
struct ref_states *states = cb_data;
struct refspec refspec;
+ if (flags & REF_ISSYMREF)
+ return 0;
+
memset(&refspec, 0, sizeof(refspec));
refspec.dst = (char *)refname;
if (!remote_find_tracking(states->remote, &refspec))
@@ -666,8 +669,10 @@ static int get_remote_ref_states(const char *name,
transport_disconnect(transport);
get_ref_states(remote_refs, states);
- } else
+ } else {
for_each_ref(append_ref_to_tracked_list, states);
+ sort_string_list(&states->tracked);
+ }
return 0;
}