aboutsummaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorUwe Kleine-König <Uwe.Kleine-Koenig@digi.com>2008-02-28 08:24:25 +0100
committerJunio C Hamano <gitster@pobox.com>2008-02-29 00:00:29 -0800
commita5aa930d506689df0f77dded8a3f5aa248b485ee (patch)
tree803001d5f659a6805959d09a3df386871f47e81d /revision.c
parent419e38337a4ff66ae2968756cc46c1bf77074814 (diff)
downloadgit-a5aa930d506689df0f77dded8a3f5aa248b485ee.tar.gz
git-a5aa930d506689df0f77dded8a3f5aa248b485ee.tar.xz
rev-list: add --branches, --tags and --remotes
These flags are already known to rev-parse and have the same meaning. This patch allows to run gitk as follows: gitk --branches --not --remotes to show only your local work. Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/revision.c b/revision.c
index 84fbdd3af..0eb6faa53 100644
--- a/revision.c
+++ b/revision.c
@@ -633,12 +633,13 @@ static int handle_one_ref(const char *path, const unsigned char *sha1, int flag,
return 0;
}
-static void handle_all(struct rev_info *revs, unsigned flags)
+static void handle_refs(struct rev_info *revs, unsigned flags,
+ int (*for_each)(each_ref_fn, void *))
{
struct all_refs_cb cb;
cb.all_revs = revs;
cb.all_flags = flags;
- for_each_ref(handle_one_ref, &cb);
+ for_each(handle_one_ref, &cb);
}
static void handle_one_reflog_commit(unsigned char *sha1, void *cb_data)
@@ -1015,7 +1016,19 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
continue;
}
if (!strcmp(arg, "--all")) {
- handle_all(revs, flags);
+ handle_refs(revs, flags, for_each_ref);
+ continue;
+ }
+ if (!strcmp(arg, "--branches")) {
+ handle_refs(revs, flags, for_each_branch_ref);
+ continue;
+ }
+ if (!strcmp(arg, "--tags")) {
+ handle_refs(revs, flags, for_each_tag_ref);
+ continue;
+ }
+ if (!strcmp(arg, "--remotes")) {
+ handle_refs(revs, flags, for_each_remote_ref);
continue;
}
if (!strcmp(arg, "--first-parent")) {