From: Jay Soffian <jaysoffian@gmail.com>
To: git@vger.kernel.org
Cc: Jay Soffian <jaysoffian@gmail.com>,
Marc Branchaud <marcnarc@xiplink.com>,
Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 03/13] remote: fix two inconsistencies in the output of "show <remote>"
Date: Mon, 23 Feb 2009 01:28:51 -0500 [thread overview]
Message-ID: <30b0e9a2ad91f17f9ebbfe9954522dcbf3b24f5e.1235368324.git.jaysoffian@gmail.com> (raw)
In-Reply-To: <cover.1235368324.git.jaysoffian@gmail.com>
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>
---
builtin-remote.c | 15 ++++++++++-----
t/t5505-remote.sh | 2 +-
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/builtin-remote.c b/builtin-remote.c
index f2ef08a..31fbd1e 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -227,10 +227,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 *ref, struct ref_states *states)
}
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);
@@ -688,6 +688,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))
@@ -754,8 +757,10 @@ static int show(int argc, const char **argv)
"prune')", &states.stale, "");
}
- if (no_query)
+ if (no_query) {
for_each_ref(append_ref_to_tracked_list, &states);
+ sort_string_list(&states.tracked);
+ }
show_list(" Tracked remote branch%s", &states.tracked, "");
if (states.remote->push_refspec_nr) {
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 104433d..fdc4a29 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -142,8 +142,8 @@ cat > test/expect << EOF
New remote branch (next fetch will store in remotes/origin)
master
Tracked remote branches
- side
master
+ side
Local branches pushed with 'git push'
master:upstream
+refs/tags/lastbackup
--
1.6.2.rc1.223.gfed32
next prev parent reply other threads:[~2009-02-23 6:31 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-23 6:28 [PATCH 00/13] New output style for git remote show Jay Soffian
2009-02-23 6:28 ` [PATCH 01/13] remote: rename variable and eliminate redundant function call Jay Soffian
2009-02-23 6:28 ` [PATCH 02/13] remote: remove unused code in get_ref_states Jay Soffian
2009-02-23 6:28 ` Jay Soffian [this message]
2009-02-23 6:28 ` [PATCH 04/13] remote: make get_remote_ref_states() always populate states.tracked Jay Soffian
2009-02-24 1:34 ` Junio C Hamano
2009-02-24 3:09 ` Jay Soffian
2009-02-24 3:13 ` Jay Soffian
2009-02-23 6:28 ` [PATCH 05/13] remote: name remote_refs consistently Jay Soffian
2009-02-23 6:28 ` [PATCH 06/13] string-list: new for_each_string_list() function Jay Soffian
2009-02-23 6:28 ` [PATCH 07/13] remote: new show output style Jay Soffian
2009-02-23 6:46 ` Jeff King
2009-02-23 23:11 ` Marc Branchaud
2009-02-23 6:28 ` [PATCH 08/13] refactor duplicated get_local_heads() to remote.c Jay Soffian
2009-02-23 6:28 ` [PATCH 09/13] refactor duplicated ref_newer() " Jay Soffian
2009-02-23 6:45 ` Jeff King
2009-02-23 7:29 ` [PATCH v2 " Jay Soffian
2009-02-23 8:53 ` Johannes Sixt
2009-02-23 13:41 ` Jay Soffian
2009-02-23 6:28 ` [PATCH 10/13] remote.c: make match_refs() copy src ref before assigning to peer_ref Jay Soffian
2009-02-24 1:34 ` Junio C Hamano
2009-02-24 3:06 ` Jay Soffian
2009-02-24 3:23 ` Junio C Hamano
2009-02-24 4:05 ` [PATCH] " Jay Soffian
2009-02-24 6:17 ` Junio C Hamano
2009-02-24 6:53 ` Jay Soffian
2009-02-24 7:12 ` Junio C Hamano
2009-02-23 6:28 ` [PATCH 11/13] remote.c: don't short-circuit match_refs() when error in match_explicit_refs() Jay Soffian
2009-02-24 1:34 ` Junio C Hamano
2009-02-24 3:07 ` Jay Soffian
2009-02-23 6:29 ` [PATCH 12/13] remote.c: refactor get_remote_ref_states() Jay Soffian
2009-02-23 6:50 ` Jeff King
2009-02-23 7:55 ` Jay Soffian
2009-02-23 8:31 ` Jay Soffian
2009-02-24 1:05 ` Jeff King
2009-02-23 6:29 ` [PATCH 13/13] remote: new show output style for push refspecs Jay Soffian
2009-02-23 6:59 ` [PATCH 00/13] New output style for git remote show Jeff King
2009-02-23 7:56 ` Jay Soffian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=30b0e9a2ad91f17f9ebbfe9954522dcbf3b24f5e.1235368324.git.jaysoffian@gmail.com \
--to=jaysoffian@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=marcnarc@xiplink.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).