Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/git-rev-list.txt3
-rw-r--r--builtin-rev-list.c3
-rw-r--r--revision.c19
3 files changed, 22 insertions, 3 deletions
diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
index a8d489f9f2..d80cdf5502 100644
--- a/Documentation/git-rev-list.txt
+++ b/Documentation/git-rev-list.txt
@@ -20,6 +20,9 @@ SYNOPSIS
[ \--full-history ]
[ \--not ]
[ \--all ]
+ [ \--branches ]
+ [ \--tags ]
+ [ \--remotes ]
[ \--stdin ]
[ \--quiet ]
[ \--topo-order ]
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 6f7d5f8214..6754e7f124 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -25,6 +25,9 @@ static const char rev_list_usage[] =
" --no-merges\n"
" --remove-empty\n"
" --all\n"
+" --branches\n"
+" --tags\n"
+" --remotes\n"
" --stdin\n"
" --quiet\n"
" ordering output:\n"
diff --git a/revision.c b/revision.c
index 84fbdd3af4..0eb6faa537 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")) {