git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Cc: Lawrence Siebert <lawrencesiebert@gmail.com>,
	git@vger.kernel.org, remi.galan-alfonso@ensimag.grenoble-inp.fr
Subject: Re: [PATCH v2 3/4] log --count: added test
Date: Fri, 03 Jul 2015 17:54:53 -0700	[thread overview]
Message-ID: <xmqqd2084u8y.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <vpqwpyh4rup.fsf@anie.imag.fr> (Matthieu Moy's message of "Fri, 03 Jul 2015 09:34:22 +0200")

Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:

> Also, some revision-limiting options can reduce the count like
>
> git log --grep whatever
>
> and you should check that you actually count the right number here.
>
> (I don't know this part of the code enough, but I'm not sure you
> actually deal with this properly)

Yes, "rev-list", when the revision range is "limited" (with or
without pathspec), can give "--count" once limit_list() finishes,
but "log" filters the result of limit_list() further with at least
three separate phases.

 - options in the "grep" family (--grep/--author/etc.) lets you skip
   commits based on the contents of the commit object;

 - options in the "diff" family (-w/-b/etc.) may let "git log"
   consider a commit because the pathspec limit thought two blobs
   were different at byte-by-byte level, but after running "diff"
   with these "looser" comparison, "git log" may realize that there
   weren't any interesting change introduced by the commit [*1*];

 - and finally, of course "log --max-count=20" may further limit the
   maximum number of commits that are shown.  This of course is not
   interesting in the context of "--count" in the sense that "git
   log --count -20 --grep=foo maint..master" may not be immediately
   a sensible thing to do (but we never know.  Perhaps your user may
   be asking "do we have 20 or more commits that say 'foo' in the
   range?")

An implementation of "--count" to take the first and the third ones
in account may not be too hard, but I am fairly familiar with the
codepath for the second one and I think it would be very tricky.

Note that these additional things "log" does over "rev-list" *DO*
justify addition of "--count" to "log" (because "rev-list --count"
cannot emulate these); I am however not sure if it is worth the
additional complexity we need to add to the codepath (especially for
the second phase).  I'd need to take another look at the codepaths
involved myself to be sure, but I suspect the damage to the codepath
for the second may end up to be extensive when we do decide to fix
the possible bug in it.


[Footnote]

*1* They may still show the log message in such a case where "-b/-w"
was asked and commit had only whitespace changes, but I think we
should consider that a bug.

  parent reply	other threads:[~2015-07-04  0:55 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 ` [PATCH v2 1/4] list-object: add get_commit_count function Lawrence Siebert
2015-07-03  7:24   ` 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 [this message]
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=xmqqd2084u8y.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=lawrencesiebert@gmail.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).