Re: [PATCH] grep --no-index: allow use of "git grep" outside a git repository

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

> 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 ...

That is fundamentally wrong.

Remember, "grep" works on two levels: a line matches or does not match the
given set of patterns (rather, the expression given), and matched lines
are shown.  A file as a whole is considered to have matched if one or more
lines produced a match, or under the --all-match option, only when all of
the top-level ORed terms in the expression have fired for some lines in
it.

And --not and --and are both elements of grep expression that determines
if the expression matches "a single line".  --author=me --and --grep=foo
would ask: does the "^author " line in the header have "me" _and_ also
string "foo" on it at the same time?

IOW, most of the "logical" stuff (including the precedence binding
parentheses) works at a line level.  --all-match is currently the only
thing that affects "grep -l" (and "will the commit get shown") behaviour
by collecting hits from the whole buffer.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]