git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH/RFC] Fix the result of "git grep -l -C <num>"

From
AYAlbert Yale <surfingalbert@gmail.com>
Date
Jan 23, 2012, 17:10 UTC
Message-ID
<CALEc4zGV6Oo-WR0vPE6=oEmm=fo4dd=nyBWFuK1oU7rmF9K41A@mail.gmail.com>
In-Reply-To
<8762g2ieq0.fsf@thomas.inf.ethz.ch>

You're right. This solution is incomplete. It needs to take into account "opt.unmatch_name_only", and possibly other states. I'm open for suggestions.

I've just posted Version 2 of this patch.

As for creating a test, I'm unfamiliar with the testing procedure for git-core. A "how to" in the "Documentation" folder would be very useful in that regard.

Albert
On Mon, Jan 23, 2012 at 11:08 AM, Thomas Rast <trast@student.ethz.ch> wrote:
Show 19 quoted lines
> Albert Yale <surfingalbert@gmail.com> writes:
>
>> When combining "git grep -l" with "-C <num>",
>> the first result is omitted.
> [...]
>> For example, if the following command should output a list of 3
>> different files (a.txt, b.txt, c.txt):
>>
>> $ git grep -l -C 1 albert_yale
>> b.txt
>> c.txt
>
> Nice catch.  Can you add a test?
>
> Is -l the only option affected?  Why isn't, for example, -L?
>
> --
> Thomas Rast
> trast@{inf,student}.ethz.ch
Previous: Thomas RastNext: Thomas Rast
Message 3 of 6 in “Fix the result of "git grep -l -C <num>"”
  1. Fix the result of "git grep -l -C <num>"Albert Yale, Jan 23, 2012
  2. Thomas RastJan 23, 2012
  3. Albert YaleJan 23, 2012
  4. grep: fix -l/-L interaction with decoration linesThomas Rast, Jan 23, 2012
  5. Albert YaleJan 23, 2012
  6. Junio C HamanoJan 29, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.