git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Petr Baudis <pasky@suse.cz>
Cc: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] Teach "log -F --author=<match>" to behave better
Date: Thu, 04 Sep 2008 12:34:19 -0700	[thread overview]
Message-ID: <7vy7271z9g.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20080904140902.GY10544@machine.or.cz> (Petr Baudis's message of "Thu, 4 Sep 2008 16:09:02 +0200")

Petr Baudis <pasky@suse.cz> writes:

> On Thu, Sep 04, 2008 at 01:31:19AM -0700, Junio C Hamano wrote:
>> To handle --author=<match> request, the code created a grep instruction
>> that tried to match a line that begins with 'author ' and <match>
>> somewhere on the same line.  "begins with 'author '" obviously needs to be
>> expressed with an regexp '^author '.
>> 
>> When the user specifies --fixed-string, this does not work at all.
>> 
>> This extends the grep machinery so that a match insn can ignore user
>> specified --fixed-string request, and uses the '( -e A --and -e B )'
>> construct from the grep machinery in order to express "has to begin with
>> '^author ', and also the same line must match the given pattern".
>> 
>> Signed-off-by: Junio C Hamano <gitster@pobox.com>
>
> Wow, this is clever solution! FWIW,

Actually, it is not clever at all.

It is a more natural solution, than what we originally had, at least from
the view of somebody who wrote our grep superstructure.  We use stock
regexp(3) library for finding individual matches, but the layer on top of
that to implement the default behaviour to --or hits together from
multiple expressions, optionally --and hits to find a line that has both
expressions, parenthesize to form groups of expressions etc. are all our
inventions.

One related thing I suspect many people haven't realized is that "git log"
can use "--all-match".

These two do different things:

	$ git log --author=Linus --grep=revision
	$ git log --all-match --author=Linus --grep=revision

The former finds commits that talk about "revision" by anybody, or commits
by Linus where he may or may not talk about "revision".  The latter finds
only commits by Linus where he talks about a word "revision" in the log
message.

I've been wondering if we want to make --all-match the default for
revision traversal family (i.e. "git log"), as I suspect it would match
people's expectations more naturally, even though it is a backward
incompatible change.  It is backward incompatible only because the
original implementation was stupid ;-).

  reply	other threads:[~2008-09-04 19:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-04  6:47 git rev-list --author/--committer b0rked with -F/--fixed-strings Giuseppe Bilotta
2008-09-04  7:12 ` Junio C Hamano
2008-09-04  8:31   ` [PATCH] Teach "log -F --author=<match>" to behave better Junio C Hamano
2008-09-04 13:33     ` Teemu Likonen
2008-09-04 19:06       ` Junio C Hamano
2008-09-04 19:25         ` Teemu Likonen
2008-09-05  1:04           ` Junio C Hamano
2008-09-04 13:56     ` Giuseppe Bilotta
2008-09-04 14:09     ` Petr Baudis
2008-09-04 19:34       ` Junio C Hamano [this message]
2008-09-05 12:35         ` --all-match Teemu Likonen
2008-09-05  4:47       ` [PATCH] Teach "log -F --author=<match>" to behave better Junio C Hamano
2008-09-04 13:46   ` git rev-list --author/--committer b0rked with -F/--fixed-strings Giuseppe Bilotta

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vy7271z9g.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=giuseppe.bilotta@gmail.com \
    --cc=pasky@suse.cz \
    /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.
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 NNTP newsgroup(s).