{"thread":{"id":"39743","subject":"[PATCH] --count feature for git shortlog","startedAt":"2015-06-29T01:22:00Z","lastAt":"2015-07-21T18:27:28Z","messageCount":15,"participants":["Lawrence Siebert","Junio C Hamano","Johannes Schindelin","John Keeping","Jeff King","Jakub Narębski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"265100","messageId":"1435540922-12208-1-git-send-email-lawrencesiebert@gmail.com","threadId":"39743","inReplyTo":null,"subject":"[PATCH] --count feature for git shortlog","fromName":"Lawrence Siebert","fromEmail":"lawrencesiebert@gmail.com","sentAt":"2015-06-29T01:22:00Z","receivedAt":"2015-06-29T01:22:00Z","isPatch":true,"sender":{"key":"lawrencesiebert@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45034?v=4"},"body":"This is a new feature for short log, which lets you count commits on a per\nfile or repository basis easily.\n\nCurrently if you want a total count of commits with shortlog, you would\nneed to add up each authors commits after using --summary. This adds a \n-N / --count option to shortlog for this purpose.  I also created\na test. It's not a great test, but it works.\n\nI'm sure I've make a beginner mistake in some part of the process;\nI've done my best to follow documentation, so please be explicit\nwhen you tell me I've done something wrong.\n\nThanks,\nLawrence Siebert\n\n\nLawrence Siebert (2):\n  shortlog: -N/--count option\n  shortlog: added --count test\n\n builtin/shortlog.c  | 14 +++++++++-----\n shortlog.h          |  1 +\n t/t4201-shortlog.sh |  5 +++++\n 3 files changed, 15 insertions(+), 5 deletions(-)\n\n-- \n1.9.1\n"},{"id":"265101","messageId":"1435540922-12208-2-git-send-email-lawrencesiebert@gmail.com","threadId":"39743","inReplyTo":"1435540922-12208-1-git-send-email-lawrencesiebert@gmail.com","subject":"[PATCH] --count feature for git shortlog","fromName":"Lawrence Siebert","fromEmail":"lawrencesiebert@gmail.com","sentAt":"2015-06-29T01:22:01Z","receivedAt":"2015-06-29T01:22:01Z","isPatch":true,"sender":{"key":"lawrencesiebert@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45034?v=4"},"body":"--summary is per author --count counts all\n\nSigned-off-by: Lawrence Siebert <lawrencesiebert@gmail.com>\n---\n builtin/shortlog.c | 14 +++++++++-----\n shortlog.h         |  1 +\n 2 files changed, 10 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex c0bab6a..4b79dc8 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -226,8 +226,10 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix)\n \tint nongit = !startup_info->have_repository;\n \n \tstatic const struct option options[] = {\n+\t\t OPT_BOOL('N', \"count\", &log.show_count,\n+\t\t\tN_(\"display the total number of commits for all authors\")),\n \t\tOPT_BOOL('n', \"numbered\", &log.sort_by_number,\n-\t\t\t N_(\"sort output according to the number of commits per author\")),\n+\t\t\t N_(\"Sort output according to the number of commits per author\")),\n \t\tOPT_BOOL('s', \"summary\", &log.summary,\n \t\t\t N_(\"Suppress commit descriptions, only provides commit count\")),\n \t\tOPT_BOOL('e', \"email\", &log.email,\n@@ -290,8 +292,8 @@ static void add_wrapped_shortlog_msg(struct strbuf *sb, const char *s,\n void shortlog_output(struct shortlog *log)\n {\n \tint i, j;\n+  unsigned int count = 0;\n \tstruct strbuf sb = STRBUF_INIT;\n-\n \tif (log->sort_by_number)\n \t\tqsort(log->list.items, log->list.nr, sizeof(struct string_list_item),\n \t\t\tcompare_by_number);\n@@ -300,7 +302,9 @@ void shortlog_output(struct shortlog *log)\n \n \t\tif (log->summary) {\n \t\t\tprintf(\"%6d\\t%s\\n\", onelines->nr, log->list.items[i].string);\n-\t\t} else {\n+\t\t} else if (log->show_count) {\n+        count += onelines->nr;\n+    } else {\n \t\t\tprintf(\"%s (%d):\\n\", log->list.items[i].string, onelines->nr);\n \t\t\tfor (j = onelines->nr - 1; j >= 0; j--) {\n \t\t\t\tconst char *msg = onelines->items[j].string;\n@@ -315,13 +319,13 @@ void shortlog_output(struct shortlog *log)\n \t\t\t}\n \t\t\tputchar('\\n');\n \t\t}\n-\n \t\tonelines->strdup_strings = 1;\n \t\tstring_list_clear(onelines, 0);\n \t\tfree(onelines);\n \t\tlog->list.items[i].util = NULL;\n \t}\n-\n+  if (log->show_count) \n+    printf(\"%d\\n\", count);\n \tstrbuf_release(&sb);\n \tlog->list.strdup_strings = 1;\n \tstring_list_clear(&log->list, 1);\ndiff --git a/shortlog.h b/shortlog.h\nindex de4f86f..57797b7 100644\n--- a/shortlog.h\n+++ b/shortlog.h\n@@ -8,6 +8,7 @@ struct shortlog {\n \tint summary;\n \tint wrap_lines;\n \tint sort_by_number;\n+\tint show_count;\n \tint wrap;\n \tint in1;\n \tint in2;\n-- \n1.9.1\n"},{"id":"265102","messageId":"1435540922-12208-3-git-send-email-lawrencesiebert@gmail.com","threadId":"39743","inReplyTo":"1435540922-12208-1-git-send-email-lawrencesiebert@gmail.com","subject":"[PATCH] --count feature for git shortlog","fromName":"Lawrence Siebert","fromEmail":"lawrencesiebert@gmail.com","sentAt":"2015-06-29T01:22:02Z","receivedAt":"2015-06-29T01:22:02Z","isPatch":true,"sender":{"key":"lawrencesiebert@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45034?v=4"},"body":"Signed-off-by: Lawrence Siebert <lawrencesiebert@gmail.com>\n---\n t/t4201-shortlog.sh | 5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh\nindex 7600a3e..33ecb4a 100755\n--- a/t/t4201-shortlog.sh\n+++ b/t/t4201-shortlog.sh\n@@ -194,4 +194,9 @@ test_expect_success 'shortlog with revision pseudo options' '\n \tgit shortlog --exclude=refs/heads/m* --all\n '\n \n+test_expect_success 'shortlog --count' '\n+\tgit shortlog --count HEAD > actual &&\n+\techo  \"4\" >expect &&\n+\ttest_cmp expect actual'\n+\n test_done\n-- \n1.9.1\n"},{"id":"265103","messageId":"xmqq1tgvdt9u.fsf@gitster.dls.corp.google.com","threadId":"39743","inReplyTo":"1435540922-12208-1-git-send-email-lawrencesiebert@gmail.com","subject":"Re: [PATCH] --count feature for git shortlog","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-06-29T04:37:33Z","receivedAt":"2015-06-29T04:37:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Lawrence Siebert <lawrencesiebert@gmail.com> writes:\n\n> This is a new feature for short log, which lets you count commits on a per\n> file or repository basis easily.\n>\n> Currently if you want a total count of commits with shortlog, you would\n> need to add up each authors commits after using --summary. This adds a \n> -N / --count option to shortlog for this purpose.\n  \nThe standard way to do that is\n\n    git log --oneline ... whatever other args ... | wc -l\n\nor more kosher from a script\n\n    git rev-list ... whatever other args ... | wc -l\n\nAdding an option to ignore per-author breakdown smells backwards.\nThe whole point of shortlog is to give you the commit stats broken\nout for each author.  I guess it is not so far-fetched to add an\noption to \"git log\" to only show the number of commits that would be\noutput, if you really wanted to avoid \"| wc -l\", but this option\ndoes not belong to shortlog.\n\nAnd it certainly does not deserve a short-and-sweet single letter\noption \"-N\", I think.\n"},{"id":"265143","messageId":"CAKDoJU4MHGa-c=F0m17rgWUCS2xFwiSb1pmDnYztoDnzRaRKCw@mail.gmail.com","threadId":"39743","inReplyTo":"CAKDoJU4HcGoOS83MKwsQBXztYrDomMd9N-2SKc6iRyNhQQM5Eg@mail.gmail.com","subject":"Re: [PATCH] --count feature for git shortlog","fromName":"Lawrence Siebert","fromEmail":"lawrencesiebert@gmail.com","sentAt":"2015-06-29T16:46:01Z","receivedAt":"2015-06-29T16:46:01Z","isPatch":true,"sender":{"key":"lawrencesiebert@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45034?v=4"},"body":"Junio,\n\nI appreciate your help. Okay, That all makes sense.\n\nI would note that something like:\n git shortlog -s \"$FILENAME:  | cut -f 1 | paste -sd+ - | bc\n\nseems like it run much faster then:\n\n git log --oneline \"$FILENAME\" | wc -l\n\nWhich was why I was looking at shortlog.  I was using it to sort files\nby commit count when provided a list of files, which git rev-list\ndoesn't really work for.\n\nAnyway I can try and put it in log proper, if you think that's the best place.\n\nThank you,\nLawrence Siebert\n"},{"id":"265145","messageId":"xmqqvbe6bg3z.fsf@gitster.dls.corp.google.com","threadId":"39743","inReplyTo":"CAKDoJU4MHGa-c=F0m17rgWUCS2xFwiSb1pmDnYztoDnzRaRKCw@mail.gmail.com","subject":"Re: [PATCH] --count feature for git shortlog","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-06-29T17:04:48Z","receivedAt":"2015-06-29T17:04:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Lawrence Siebert <lawrencesiebert@gmail.com> writes:\n\n> I was using it to sort files\n> by commit count when provided a list of files, which git rev-list\n> doesn't really work for.\n\nWhat makes you say rev-list does not work (perhaps 'really' is the\nkey word there?)\n\n    git rev-list --no-merges maint..master -- Makefile\n    git shortlog --no-merges maint..master -- Makefile\n    git log --oneline --no-merges maint..master -- Makefile\n\nall gives me results that are consistent among them.\n"},{"id":"265191","messageId":"CAKDoJU4Wjx1XJ383qgikpPXr7bP3eHObR3Cu5nCjVuO-1omCag@mail.gmail.com","threadId":"39743","inReplyTo":"xmqqvbe6bg3z.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] --count feature for git shortlog","fromName":"Lawrence Siebert","fromEmail":"lawrencesiebert@gmail.com","sentAt":"2015-06-29T21:33:10Z","receivedAt":"2015-06-29T21:33:10Z","isPatch":true,"sender":{"key":"lawrencesiebert@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45034?v=4"},"body":"My apologies, I misunderstood and thought rev-list didn't take filenames.\n\nLawrence Siebert\n\nOn Mon, Jun 29, 2015 at 10:04 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Lawrence Siebert <lawrencesiebert@gmail.com> writes:\n>\n>> I was using it to sort files\n>> by commit count when provided a list of files, which git rev-list\n>> doesn't really work for.\n>\n> What makes you say rev-list does not work (perhaps 'really' is the\n> key word there?)\n>\n>     git rev-list --no-merges maint..master -- Makefile\n>     git shortlog --no-merges maint..master -- Makefile\n>     git log --oneline --no-merges maint..master -- Makefile\n>\n> all gives me results that are consistent among them.\n>\n\n\n\n-- \nAbout Me: http://about.me/lawrencesiebert\nConstantly Coding: http://constantcoding.blogspot.com\n"},{"id":"265211","messageId":"19801032cd7af95bc8030f54d740bf48@www.dscho.org","threadId":"39743","inReplyTo":"CAKDoJU4MHGa-c=F0m17rgWUCS2xFwiSb1pmDnYztoDnzRaRKCw@mail.gmail.com","subject":"Re: [PATCH] --count feature for git shortlog","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2015-06-30T12:10:49Z","receivedAt":"2015-06-30T12:10:49Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Lawrence,\n\nOn 2015-06-29 18:46, Lawrence Siebert wrote:\n\n> I appreciate your help. Okay, That all makes sense.\n> \n> I would note that something like:\n>  git shortlog -s \"$FILENAME:  | cut -f 1 | paste -sd+ - | bc\n> \n> seems like it run much faster then:\n> \n>  git log --oneline \"$FILENAME\" | wc -l\n\nHow does it compare to `git rev-list -- \"$FILENAME\" | wc -l`?\n\nCiao,\nJohannes\n"},{"id":"265223","messageId":"20150630122323.GY18226@serenity.lan","threadId":"39743","inReplyTo":"19801032cd7af95bc8030f54d740bf48@www.dscho.org","subject":"Re: [PATCH] --count feature for git shortlog","fromName":"John Keeping","fromEmail":"john@keeping.me.uk","sentAt":"2015-06-30T12:23:24Z","receivedAt":"2015-06-30T12:23:24Z","isPatch":true,"sender":{"key":"john@keeping.me.uk","avatar":"https://avatars.githubusercontent.com/u/1702081?v=4"},"body":"On Tue, Jun 30, 2015 at 02:10:49PM +0200, Johannes Schindelin wrote:\n> On 2015-06-29 18:46, Lawrence Siebert wrote:\n> \n> > I appreciate your help. Okay, That all makes sense.\n> > \n> > I would note that something like:\n> >  git shortlog -s \"$FILENAME:  | cut -f 1 | paste -sd+ - | bc\n> > \n> > seems like it run much faster then:\n> > \n> >  git log --oneline \"$FILENAME\" | wc -l\n> \n> How does it compare to `git rev-list -- \"$FILENAME\" | wc -l`?\n\nOr even `git rev-list --count HEAD -- \"$FILENAME\"`.\n"},{"id":"265282","messageId":"CAKDoJU42kDs3QXYjo7rJ-vLMJtUdv9AwttJLHnya+toG6cSatQ@mail.gmail.com","threadId":"39743","inReplyTo":"CAKDoJU4cEvWvfnFsvfOJ_P0UOrD3RpLK1NdfxaUPiDTWXYg-oA@mail.gmail.com","subject":"Re: [PATCH] --count feature for git shortlog","fromName":"Lawrence Siebert","fromEmail":"lawrencesiebert@gmail.com","sentAt":"2015-07-01T03:00:53Z","receivedAt":"2015-07-01T03:00:53Z","isPatch":true,"sender":{"key":"lawrencesiebert@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45034?v=4"},"body":"Vincent, I'm ccing you because of --use-bitmap-index\n\nJohn, Johannes,\n\nI really appreciate both your thoughts.\n\n`git rev-list --count HEAD -- \"$FILENAME\"` runs noticeably faster then\nmy patch code for `git shortlog --count`, git shortlog -s \"$FILENAME\"\n| cut -f 1 | paste -sd+ -|bc, and faster than any use of piping to wc\n-l mentioned so far.  Anyway I think Junio is quite right that my code\ndoesn't belong in shortlog, at least as it currently is.\n\nI have some ideas for future work for myself, both code and\ndocumentation changes.  I can detail it and get comments first, or\njust submit patches and get comments after, whichever is the preferred\npractice. One in particular is worth mentioning.\n\nThe following doesn't currently run:  `git rev-list --count\n--use-bitmap-index HEAD`\n\nThis is an optional parameter for rev-list from commit\naa32939fea9c8934b41efce56015732fa12b8247 which can't currently be used\nbecause of changes in parameter parsing, but which modifies `--count`\nand which may be faster. I've gotten it working again, both by\nchanging the current repo code to make it work, and also by building\nfrom that commit, and when I tested it on the whole repo, it seems\nlike it's less variable in speed then `git rev-list --count HEAD`. but\nnot necessarily consistently faster like tests suggested it was when\nit was committed. Obviously I'm not testing on the same system as the\noriginal committer, or with the same compiler, or even using the same\nversion of the linux kernel repo, so those may be a factor.  It may\nalso work better in a circumstance that I haven't accounted for, like\nan older repo, on a per file basis when getting per file commit counts\nfor all files, or something like that.\n\nI'm thinking I could submit a patch that makes it work again, and\nleave it to the user to decide whether to use it or not.   There is\nalso a --test-bitmap option which compares the regular count with the\nbitmap count. I'm not sure if the implication there was regression\ntesting or that --use-bitmap-index might give the wrong results in\ncertain circumstances.  Vincent, could you clarify?\n\nThanks,\nLawrence Siebert\nhttp://www.github.com/gryftir\n\nOn Tue, Jun 30, 2015 at 5:23 AM, John Keeping <john@keeping.me.uk> wrote:\n>\n> On Tue, Jun 30, 2015 at 02:10:49PM +0200, Johannes Schindelin wrote:\n> > On 2015-06-29 18:46, Lawrence Siebert wrote:\n> >\n> > > I appreciate your help. Okay, That all makes sense.\n> > >\n> > > I would note that something like:\n> > >  git shortlog -s \"$FILENAME:  | cut -f 1 | paste -sd+ - | bc\n> > >\n> > > seems like it run much faster then:\n> > >\n> > >  git log --oneline \"$FILENAME\" | wc -l\n> >\n> > How does it compare to `git rev-list -- \"$FILENAME\" | wc -l`?\n>\n> Or even `git rev-list --count HEAD -- \"$FILENAME\"`.\n"},{"id":"265321","messageId":"20150701115036.GA31158@peff.net","threadId":"39743","inReplyTo":"CAKDoJU42kDs3QXYjo7rJ-vLMJtUdv9AwttJLHnya+toG6cSatQ@mail.gmail.com","subject":"Re: [PATCH] --count feature for git shortlog","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-07-01T11:50:37Z","receivedAt":"2015-07-01T11:50:37Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jun 30, 2015 at 08:00:53PM -0700, Lawrence Siebert wrote:\n\n> The following doesn't currently run:  `git rev-list --count\n> --use-bitmap-index HEAD`\n> \n> This is an optional parameter for rev-list from commit\n> aa32939fea9c8934b41efce56015732fa12b8247 which can't currently be used\n> because of changes in parameter parsing, but which modifies `--count`\n> and which may be faster. I've gotten it working again, both by\n> changing the current repo code to make it work, and also by building\n> from that commit, and when I tested it on the whole repo, it seems\n> like it's less variable in speed then `git rev-list --count HEAD`. but\n> not necessarily consistently faster like tests suggested it was when\n> it was committed. Obviously I'm not testing on the same system as the\n> original committer, or with the same compiler, or even using the same\n> version of the linux kernel repo, so those may be a factor.  It may\n> also work better in a circumstance that I haven't accounted for, like\n> an older repo, on a per file basis when getting per file commit counts\n> for all files, or something like that.\n\nCan you give more details?\n\nIn a copy of linux.git with bitmaps:\n\n  $ git log -1 --oneline\n  64fb1d0 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc\n\n  $ ls -l .git/objects/pack/\n  total 892792\n  -r--r--r-- 1 peff peff  24498374 May 21 13:39 pack-182149ca37c3f2d8fa190e4add772ae08af0e9d2.bitmap\n  -r--r--r-- 1 peff peff 115283036 May 21 13:39 pack-182149ca37c3f2d8fa190e4add772ae08af0e9d2.idx\n  -r--r--r-- 1 peff peff 774420808 May 21 13:39 pack-182149ca37c3f2d8fa190e4add772ae08af0e9d2.pack\n\nThe packfiles were created with \"git repack -adb\". It shows big\nspeedups for this exact operation:\n\n  $ git version\n  git version 2.5.0.rc0\n\n  $ time git rev-list --count HEAD\n  515406\n\n  real    0m9.500s\n  user    0m9.424s\n  sys     0m0.092s\n\n  $ time git rev-list --use-bitmap-index --count HEAD\n  515406\n\n  real    0m0.392s\n  user    0m0.328s\n  sys     0m0.064s\n\nNote that this would not work with, say:\n\n  git rev-list --use-bitmap-index --count HEAD -- Makefile\n\nas the bitmap index does not have enough information to do path limiting\n(we should probably disallow this or fall back to the non-bitmap code\npath, but right now we just ignore the path limiter).\n\n> I'm thinking I could submit a patch that makes it work again, and\n> leave it to the user to decide whether to use it or not.   There is\n> also a --test-bitmap option which compares the regular count with the\n> bitmap count. I'm not sure if the implication there was regression\n> testing or that --use-bitmap-index might give the wrong results in\n> certain circumstances.  Vincent, could you clarify?\n\nYes, `--test-bitmap` is just for internal testing; you should always get\nthe same results.\n\n-Peff\n"},{"id":"265323","messageId":"xmqqh9pnc3jk.fsf@gitster.dls.corp.google.com","threadId":"39743","inReplyTo":"20150701115036.GA31158@peff.net","subject":"Re: [PATCH] --count feature for git shortlog","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-07-01T15:15:27Z","receivedAt":"2015-07-01T15:15:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> Note that this would not work with, say:\n>\n>   git rev-list --use-bitmap-index --count HEAD -- Makefile\n>\n> as the bitmap index does not have enough information to do path limiting\n> (we should probably disallow this or fall back to the non-bitmap code\n> path, but right now we just ignore the path limiter).\n\nYeah, at least the former but preferrably the latter.\n\nThanks.\n"},{"id":"265465","messageId":"xmqqfv555es7.fsf@gitster.dls.corp.google.com","threadId":"39743","inReplyTo":"20150630122323.GY18226@serenity.lan","subject":"Re: [PATCH] --count feature for git shortlog","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-07-03T17:31:20Z","receivedAt":"2015-07-03T17:31:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"John Keeping <john@keeping.me.uk> writes:\n\n> On Tue, Jun 30, 2015 at 02:10:49PM +0200, Johannes Schindelin wrote:\n>> On 2015-06-29 18:46, Lawrence Siebert wrote:\n>> \n>> > I appreciate your help. Okay, That all makes sense.\n>> > \n>> > I would note that something like:\n>> >  git shortlog -s \"$FILENAME:  | cut -f 1 | paste -sd+ - | bc\n>> > \n>> > seems like it run much faster then:\n>> > \n>> >  git log --oneline \"$FILENAME\" | wc -l\n>> \n>> How does it compare to `git rev-list -- \"$FILENAME\" | wc -l`?\n>\n> Or even `git rev-list --count HEAD -- \"$FILENAME\"`.\n\nAhh, OK.  I didn't know we already had \"rev-list --count\".\n\nThen please disregard the suggestion to add the option to \"log\"; it\nstill holds true that the option does not belong to \"shortlog\", but\nI do think \"how many changes were made to this path\" statistics\ndriven by a script should use \"rev-list\" plumbing, and if it already\nhas \"--count\" option, that is perfect ;-)\n\nThanks.\n"},{"id":"265480","messageId":"CAKDoJU7om3DBVYMD_yYet_cGep12RCUePtvFS7=TdW_1rkuE+Q@mail.gmail.com","threadId":"39743","inReplyTo":"xmqqfv555es7.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] --count feature for git shortlog","fromName":"Lawrence Siebert","fromEmail":"lawrencesiebert@gmail.com","sentAt":"2015-07-03T23:32:31Z","receivedAt":"2015-07-03T23:32:31Z","isPatch":true,"sender":{"key":"lawrencesiebert@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45034?v=4"},"body":"On Fri, Jul 3, 2015 at 10:31 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> John Keeping <john@keeping.me.uk> writes:\n>\n>> On Tue, Jun 30, 2015 at 02:10:49PM +0200, Johannes Schindelin wrote:\n>>> On 2015-06-29 18:46, Lawrence Siebert wrote:\n>>>\n>>> > I appreciate your help. Okay, That all makes sense.\n>>> >\n>>> > I would note that something like:\n>>> >  git shortlog -s \"$FILENAME:  | cut -f 1 | paste -sd+ - | bc\n>>> >\n>>> > seems like it run much faster then:\n>>> >\n>>> >  git log --oneline \"$FILENAME\" | wc -l\n>>>\n>>> How does it compare to `git rev-list -- \"$FILENAME\" | wc -l`?\n>>\n>> Or even `git rev-list --count HEAD -- \"$FILENAME\"`.\n>\n> Ahh, OK.  I didn't know we already had \"rev-list --count\".\n>\n> Then please disregard the suggestion to add the option to \"log\"; it\n> still holds true that the option does not belong to \"shortlog\", but\n> I do think \"how many changes were made to this path\" statistics\n> driven by a script should use \"rev-list\" plumbing, and if it already\n> has \"--count\" option, that is perfect ;-)\n>\n> Thanks.\n>\n>\n>\nJunio,\n\nI think, respectfully, there is still a benefit to adding it as a\nfeature to \"log\", in that more Git users know of and use \"log\" than\n\"rev-list\". I hadn't heard of \"rev-list\" before joining this mailing\nlist.\n\nThat means \"log --count\" will get used more. That also means that more\neyeballs will hit --count with bug reports and better tests; I've\nalready seen 2-3 suggestions for \"log --count\" tests that \"rev-list\n--count\" also doesn't have tests for.\n\nI would like to keep working on implementing \"log --count\", sharing\ncode with rev-list where possible so they both are improved, unless\nyou are saying you won't merge.\n\nThanks,\nLawrence\n\n\n\n-- \nAbout Me: http://about.me/lawrencesiebert\nConstantly Coding: http://constantcoding.blogspot.com\n"},{"id":"266556","messageId":"55AE8F10.8080905@gmail.com","threadId":"39743","inReplyTo":"CAKDoJU7om3DBVYMD_yYet_cGep12RCUePtvFS7=TdW_1rkuE+Q@mail.gmail.com","subject":"Re: [PATCH] --count feature for git shortlog","fromName":"Jakub Narębski","fromEmail":"jnareb@gmail.com","sentAt":"2015-07-21T18:27:28Z","receivedAt":"2015-07-21T18:27:28Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Lawrence Siebert wrote:\n> On Fri, Jul 3, 2015 at 10:31 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>> John Keeping <john@keeping.me.uk> writes:\n\n>>> Or even `git rev-list --count HEAD -- \"$FILENAME\"`.\n>>\n>> Ahh, OK.  I didn't know we already had \"rev-list --count\".\n>>\n>> Then please disregard the suggestion to add the option to \"log\"; it\n>> still holds true that the option does not belong to \"shortlog\", but\n>> I do think \"how many changes were made to this path\" statistics\n>> driven by a script should use \"rev-list\" plumbing, and if it already\n>> has \"--count\" option, that is perfect ;-)\n>>\n> Junio,\n> \n> I think, respectfully, there is still a benefit to adding it as a\n> feature to \"log\", in that more Git users know of and use \"log\" than\n> \"rev-list\". I hadn't heard of \"rev-list\" before joining this mailing\n> list.\n> \n> That means \"log --count\" will get used more. That also means that more\n> eyeballs will hit --count with bug reports and better tests; I've\n> already seen 2-3 suggestions for \"log --count\" tests that \"rev-list\n> --count\" also doesn't have tests for.\n> \n> I would like to keep working on implementing \"log --count\", sharing\n> code with rev-list where possible so they both are improved, unless\n> you are saying you won't merge.\n\nLawrence,\n\nAs git-rev-list is (mainly) plumbing for git-log porcelain, I think\nwhat you would need to do to add \"--count\" support to \"git log\" is\njust parse option, exclude nonsense combinations, and pass down to\nthe revision parsing machinery.\n\nHTH\n-- \nJakub Narębski\n"}]}