summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8d76792)
raw | patch | inline | side by side (parent: 8d76792)
author | Olivier Marin <dkr@freesurf.fr> | |
Tue, 10 Jun 2008 22:54:49 +0000 (00:54 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 11 Jun 2008 06:18:13 +0000 (23:18 -0700) |
Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-remote.c | patch | blob | history | |
t/t5505-remote.sh | patch | blob | history |
diff --git a/builtin-remote.c b/builtin-remote.c
index 6bce55cd53c062bebcee3d085f1ae74eae9c299e..4b00cf92581e6f8cbe81c3d54825d210a2ccf979 100644 (file)
--- a/builtin-remote.c
+++ b/builtin-remote.c
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;
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 ?
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index c17d9dcc74e02eb9f7bfc743df85e1e99ae6bd77..1e192a2207a4b56d477e8e3efc382c3a296ba776 100755 (executable)
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
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