From: Lawrence Siebert <lawrencesiebert@gmail.com>
To: git@vger.kernel.org
Cc: remi.galan-alfonso@ensimag.grenoble-inp.fr, gitster@pobox.com,
Lawrence Siebert <lawrencesiebert@gmail.com>
Subject: [PATCH v2 1/4] list-object: add get_commit_count function
Date: Thu, 2 Jul 2015 16:50:08 -0700 [thread overview]
Message-ID: <1435881011-13879-2-git-send-email-lawrencesiebert@gmail.com> (raw)
In-Reply-To: <1435881011-13879-1-git-send-email-lawrencesiebert@gmail.com>
Moving commit counting from rev-list into list-object which is a step
toward letting git log do counting as well.
Signed-off-by: Lawrence Siebert <lawrencesiebert@gmail.com>
---
builtin/rev-list.c | 12 ++----------
list-objects.c | 14 ++++++++++++++
list-objects.h | 1 +
3 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index ff84a82..07f522b 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -388,16 +388,8 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
traverse_commit_list(&revs, show_commit, show_object, &info);
- if (revs.count) {
- if (revs.left_right && revs.cherry_mark)
- printf("%d\t%d\t%d\n", revs.count_left, revs.count_right, revs.count_same);
- else if (revs.left_right)
- printf("%d\t%d\n", revs.count_left, revs.count_right);
- else if (revs.cherry_mark)
- printf("%d\t%d\n", revs.count_left + revs.count_right, revs.count_same);
- else
- printf("%d\n", revs.count_left + revs.count_right);
- }
+ if (revs.count)
+ get_commit_count(&revs);
return 0;
}
diff --git a/list-objects.c b/list-objects.c
index 41736d2..6f76301 100644
--- a/list-objects.c
+++ b/list-objects.c
@@ -234,3 +234,17 @@ void traverse_commit_list(struct rev_info *revs,
object_array_clear(&revs->pending);
strbuf_release(&base);
}
+
+void get_commit_count(struct rev_info * revs) {
+ if (revs->count) {
+ if (revs->left_right && revs->cherry_mark)
+ printf("%d\t%d\t%d\n", revs->count_left, revs->count_right, revs->count_same);
+ else if (revs->left_right)
+ printf("%d\t%d\n", revs->count_left, revs->count_right);
+ else if (revs->cherry_mark)
+ printf("%d\t%d\n", revs->count_left + revs->count_right, revs->count_same);
+ else
+ printf("%d\n", revs->count_left + revs->count_right);
+ }
+ return;
+}
diff --git a/list-objects.h b/list-objects.h
index 136a1da..d28c1f3 100644
--- a/list-objects.h
+++ b/list-objects.h
@@ -7,5 +7,6 @@ void traverse_commit_list(struct rev_info *, show_commit_fn, show_object_fn, voi
typedef void (*show_edge_fn)(struct commit *);
void mark_edges_uninteresting(struct rev_info *, show_edge_fn);
+void get_commit_count(struct rev_info * revs);
#endif
--
1.9.1
next prev parent reply other threads:[~2015-07-02 23:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-02 23:50 [PATCH v2 0/4] git log --count Lawrence Siebert
2015-07-02 23:50 ` Lawrence Siebert [this message]
2015-07-03 7:24 ` [PATCH v2 1/4] list-object: add get_commit_count function Matthieu Moy
2015-07-03 8:09 ` Lawrence Siebert
2015-07-03 8:59 ` Matthieu Moy
2015-07-02 23:50 ` [PATCH v2 2/4] log: add --count option to git log Lawrence Siebert
2015-07-03 7:29 ` Matthieu Moy
2015-07-03 8:05 ` Lawrence Siebert
2015-07-03 9:16 ` Matthieu Moy
2015-07-02 23:50 ` [PATCH v2 3/4] log --count: added test Lawrence Siebert
2015-07-03 7:34 ` Matthieu Moy
2015-07-03 8:30 ` Lawrence Siebert
2015-07-03 9:16 ` Matthieu Moy
2015-07-03 9:54 ` Matthieu Moy
2015-07-04 0:57 ` Junio C Hamano
2015-07-04 0:54 ` Junio C Hamano
2015-07-02 23:50 ` [PATCH v2 4/4] git-log: update man documentation for --count Lawrence Siebert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1435881011-13879-2-git-send-email-lawrencesiebert@gmail.com \
--to=lawrencesiebert@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=remi.galan-alfonso@ensimag.grenoble-inp.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).