Re: git grep -F doesn't behave like grep -F?

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

 



On 18 May 2012 13:37, René Scharfe <rene.scharfe@xxxxxxxxxxxxxx> wrote:
> Am 18.05.2012 13:00, schrieb Torne (Richard Coles):
>
>> Hi folks,
>>
>> git grep -F is documented as: "Use fixed strings for patterns (don’t
>> interpret pattern as a regex)."
>>
>> whereas grep -F is documented as "Interpret PATTERN as a  list  of
>> fixed  strings,  separated  by newlines,  any  of  which is to be
>> matched."
>>
>> This accurately describes how they behave, which means that git grep
>> -F with a pattern containing newlines never matches anything (at least
>> as far as I can see). Is this intentional, or an oversight? The
>> ability to grep -F for a list (e.g. the output of another grep) is
>> pretty handy...
>
>
> You could use -f- (read patterns from stdin).

Ah, yes, rewriting

git grep -F "`git grep -o someregex`"

as

git grep -o someregex | git grep -F -f-

works, but it's not how I immediately think to do it :)

> That said, it looks like a missing feature to me -- at least I didn't know
> that grep -F takes newline separated lists of search strings.  And this
> doesn't seem to be restricted to invocations with -F, only; a plain grep
> with regexps does it as well.

Yeah, it doesn't seem like adding it would break anything; patterns
with newlines don't match any lines by definition currently :)

-- 
Torne (Richard Coles)
torne@xxxxxxxxxx
--
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]