Re: [PATCH 1/4] list-object: add get_commit_count function

2015-07-03 Thread Jeff King
On Fri, Jul 03, 2015 at 10:49:40AM -0700, Junio C Hamano wrote:

 Lawrence Siebert lawrencesieb...@gmail.com writes:
 
  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 lawrencesieb...@gmail.com
  ---
 
 No way.  Look at the things provided by list-objects.c API.  They
 are not about formatting outputs.  printf() calls do not belong
 there.

Moreover, if we are going to provide an abstracted function to show the
commit count, we would also need to provide one to _create_ the count.
IOW, this get_commit_count, wherever it goes, should be accompanied by
the matching code that is put into show_commit in patch 2.

-Peff
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/4] list-object: add get_commit_count function

2015-07-03 Thread Junio C Hamano
Lawrence Siebert lawrencesieb...@gmail.com writes:

 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 lawrencesieb...@gmail.com
 ---

No way.  Look at the things provided by list-objects.c API.  They
are not about formatting outputs.  printf() calls do not belong
there.

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/4] list-object: add get_commit_count function

2015-07-02 Thread Remi Galan Alfonso
Lawrence Siebert lawrencesieb...@gmail.com writes:
 +get_commit_count(revs);  

There's trailing whitespace here.
(See my message in 3/4)

RĂ©mi
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] list-object: add get_commit_count function

2015-07-01 Thread Lawrence Siebert
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 lawrencesieb...@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..7b091db 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

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html