summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorThomas Rast <trast@student.ethz.ch>2010-06-10 11:47:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-06-12 16:39:06 (GMT)
commitf69c501832ecd6880602c55565508e70c3a013d5 (patch)
tree0249f7780dd2aac4023e4f44c7670188c7778650 /revision.c
parent3499cb1ae7b97ce8f67879156e2014e31dd985b6 (diff)
downloadgit-f69c501832ecd6880602c55565508e70c3a013d5.zip
git-f69c501832ecd6880602c55565508e70c3a013d5.tar.gz
git-f69c501832ecd6880602c55565508e70c3a013d5.tar.bz2
rev-list: introduce --count option
Add a --count option that, instead of actually listing the commits, merely counts them. This is mostly geared towards script use, and to this end it acts specially when used with --left-right: it outputs the left and right counts separately. Previously, scripts would have to run a shell loop or small inline script over to achieve the same. (Without --left-right, a simple |wc -l does the job.) Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/revision.c b/revision.c
index f4b8b38..21b133c 100644
--- a/revision.c
+++ b/revision.c
@@ -1146,6 +1146,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
revs->boundary = 1;
} else if (!strcmp(arg, "--left-right")) {
revs->left_right = 1;
+ } else if (!strcmp(arg, "--count")) {
+ revs->count = 1;
} else if (!strcmp(arg, "--cherry-pick")) {
revs->cherry_pick = 1;
revs->limited = 1;