aboutsummaryrefslogtreecommitdiff
path: root/builtin-remote.c
diff options
context:
space:
mode:
authorOlivier Marin <dkr@freesurf.fr>2008-06-11 00:54:49 +0200
committerJunio C Hamano <gitster@pobox.com>2008-06-10 23:18:13 -0700
commite7d5a97d5e131925ccae48db94f2069631a8aa41 (patch)
treedbce685afdf8c4f1bd4330c3add62ed36cf7e6d7 /builtin-remote.c
parent8d7679276af861b44e307c9879f6c4774f4944fc (diff)
downloadgit-e7d5a97d5e131925ccae48db94f2069631a8aa41.tar.gz
git-e7d5a97d5e131925ccae48db94f2069631a8aa41.tar.xz
remote show: list tracked remote branches with -n
Signed-off-by: Olivier Marin <dkr@freesurf.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-remote.c')
-rw-r--r--builtin-remote.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/builtin-remote.c b/builtin-remote.c
index 6bce55cd5..4b00cf925 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -444,6 +444,22 @@ static int get_remote_ref_states(const char *name,
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)) {
+ path_list_append(skip_prefix(refspec.src, "refs/heads/"),
+ &states->tracked);
+ }
+
+ return 0;
+}
+
static int show(int argc, const char **argv)
{
int no_query = 0, result = 0;
@@ -494,10 +510,12 @@ static int show(int argc, const char **argv)
strbuf_release(&buf);
show_list(" Stale tracking branch%s (use 'git remote "
"prune')", &states.stale);
- show_list(" Tracked remote branch%s",
- &states.tracked);
}
+ 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) {
printf(" Local branch%s pushed with 'git push'\n ",
states.remote->push_refspec_nr > 1 ?