git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, David Aguilar <davvid@gmail.com>,
	Nanako Shiraishi <nanako3@lavabit.com>
Subject: Re: [PATCH] grep --no-index: allow use of "git grep" outside a git repository
Date: Mon, 18 Jan 2010 00:57:03 -0500	[thread overview]
Message-ID: <20100118055703.GA17879@coredump.intra.peff.net> (raw)
In-Reply-To: <7v3a24ukku.fsf@alter.siamese.dyndns.org>

On Sun, Jan 17, 2010 at 08:02:25PM -0800, Junio C Hamano wrote:

> Subject: "log --author=me --grep=it" should find intersection, not union
> 
> Historically, any grep filter in "git log" family of commands were taken
> as restricting to commits with any of the words in the commit log message.
> However, the user almost always want to find commits "done by this person
> on that topic".  With "--all-match" option, a series of grep patterns can
> be turned into a requirement that all of them must produce a match, but
> that makes it impossible to ask for "done by me, on either this or that"
> with:
> 
> 	log --author=me --grep=this --grep=that
> 
> because it will require both "this" and "that" to appear.
> 
> Change the "header" parser of grep library to treat the headers specially.
> When parsing the above, behave as if it was specified like this on the
> command line:
> 
> 	--all-match --author=me '(' --grep=this --grep=that ')'
> 
> Even though the "log" command line parser doesn't give direct access to
> the extended grep syntax to group terms with parentheses, this change will
> cover the majority of the case the users would want.

Hmm. I like the new behavior. The implementation feels a little
hack-ish, like we should really be supporting full-on:

  git log --author=me --and --grep=foo

That gets a little weird, though. We already have "--not" for ref
limiting, so clearly there is some conflict over exactly what logical
operators would be operating on. I guess we could use context to see
that the adjacent arguments were grep-related.

So perhaps, as you say, this is enough as it covers the usual case.

-Peff

  reply	other threads:[~2010-01-18  5:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-13 16:13 Filenames and prefixes in extended diffs Andreas Gruenbacher
2010-01-13 19:49 ` Junio C Hamano
2010-01-14  0:16 ` Junio C Hamano
2010-01-15 13:32   ` Nanako Shiraishi
2010-01-15 18:09     ` Junio C Hamano
2010-01-15 20:50       ` [PATCH] grep: prepare to run outside of a work tree Junio C Hamano
2010-01-15 20:52       ` [PATCH] grep --no-index: allow use of "git grep" outside a git repository Junio C Hamano
2010-01-15 21:08         ` Jeff King
2010-01-16  1:05           ` Junio C Hamano
2010-01-16  1:15             ` Jeff King
2010-01-16  4:15               ` Junio C Hamano
2010-01-16  6:51                 ` David Aguilar
2010-01-16  7:21                   ` Junio C Hamano
2010-01-18  1:51                 ` Jeff King
2010-01-18  3:35                   ` Junio C Hamano
2010-01-18  4:02                     ` Junio C Hamano
2010-01-18  5:57                       ` Jeff King [this message]
2010-01-18  6:30                         ` Junio C Hamano
2010-01-18  6:50                           ` Jeff King
2010-01-18 23:22   ` Filenames and prefixes in extended diffs Andreas Gruenbacher

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=20100118055703.GA17879@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=nanako3@lavabit.com \
    /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).