提交 e7d5a97d 编写于 作者: O Olivier Marin 提交者: Junio C Hamano

remote show: list tracked remote branches with -n

Signed-off-by: NOlivier Marin <dkr@freesurf.fr>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 8d767927
......@@ -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 ?
......
......@@ -143,6 +143,8 @@ cat > test/expect << EOF
URL: $(pwd)/one/.git
Remote branch merged with 'git pull' while on branch master
master
Tracked remote branches
master side
Local branches pushed with 'git push'
master:upstream +refs/tags/lastbackup
EOF
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册