Subject: Re: git grep failure?

From: Junio C Hamano <[email-masked]>
Date: Wed, 18 Mar 2026 22:16:40 -0700

Randy Dunlap <[email-masked]> writes:

> On 3/18/26 5:38 PM, Jeff King wrote:
>> On Wed, Mar 18, 2026 at 04:28:17PM -0700, Randy Dunlap wrote:
>> 
>>> If I apply the patch at
>>> https://lore.kernel.org/linux-doc/[email-masked]/
>>>
>>> Subject: [PATCH 02/15] mm: add documentation for the mmap_prepare file operation callback
>>>
>>> to the Linux kernel tree (e.g., linux-next-20260316), it applies cleanly.
>>>
>>> I noticed a typo in the patch ("struct vma_area_desc" should be
>>> "struct vm_area_desc"). When I run
>>> $ git grep vma_area_desc
>>> the output is empty.
>>>
>>> Is this expected? (but not by me :)
>> 
>> I applied the patch and git-grep does produce one line of output (the
>> instance added by the patch).
>> 
>> Two possible differences:
>> 
>>   - are you sure the patch application succeeded?
>
> 'git apply filename.patch' succeeded AFAICT. git status shows one
> untracked file (the one that is added by the patch).
> Do I need to do 'git commit' also?

"git apply filename.patch" or "git apply --index filename.patch"?
The former will leave the new file unknown to "git", so "git grep"
would not look into it.

>>   - are you in a different subdirectory? By default git-grep narrows its
>>     search to your current working directory and its subdirectories. So
>>     if you are in arch/ or something, it would not find the result in
>>     Documentation/. You can do:
>> 
>>       git grep vma_area_desc :/
>> 
>>     to search from the root of the project.
>
> I'm running 'git grep' from the top-level directory of the
> kernel source tree.
>
> thanks.