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

Re: [Bug Report] git log -L:<funcname>:<file>

From
WZWeishi Zeng <amwish.zeng@gmail.com>
Date
May 20, 2021, 06:45 UTC
Message-ID
<CAH6yD_a+OtAbGcJbvTTY1Sx3uHk9e9v4LE2zA1POO8YXiq+qZA@mail.gmail.com>
In-Reply-To
<83740d18-e0ba-e6b5-0356-144373708d4e@gmail.com>
Thanks Bagas.
Looking at it further the problem seems to be with the leading space/tab.
Here's a single line I can reproduce in the latest version.
===
    private static Optional<String> myFunction(String a) {}
===
It works if you delete the 2 leading tab. (same for 4 leading space)
Command executed:
git log -L:'myFunction':~/a.java
On Wed, May 19, 2021 at 8:18 PM Bagas Sanjaya <bagasdotme@gmail.com> wrote:
Show 42 quoted lines
>
> Hi Weishi,
>
> On 20/05/21 07.11, Weishi Zeng wrote:
> > Summary:
> > git log -L:<funcname>:<file>
> > would fail if there's any java-style comment that appears before the
> > <funcname> string in the file.
> >
> >
> > Details:
> > Thank you for filling out a Git bug report!
> > Please answer the following questions to help us understand your issue.
> >
> > What did you do before the bug happened? (Steps to reproduce your issue)
> > git log -L:'myFunction':~/a.java
> > The file is a java file that contains comment before the function name.
> > E.g.
> > /**
> > * comments will interrupt the regex match
> > */
> > private static void myFunction() {}
> >
> > What did you expect to happen? (Expected behavior)
> > As described, it should return me the commit history that touched this function
> >
> > What happened instead? (Actual behavior)
> > It returns error:
> > fatal: -L parameter 'myFunction' starting at line 1: no match
> >
> > Anything else you want to add:
> > If the function name string to search for appears before any
> > java-style comment, it returns a valid response.
> >
>
> I can't reproduce this issue on my system (Ubuntu 20.04) using latest Git
> (2.32.0-rc0), compiled with gcc 9.3.0.
>
> Please compile latest Git on your system, repeat and report.
>
> --
> An old man doll... just what I always wanted! - Clara
Previous: Bagas SanjayaNext: Atharva Raykar
Message 3 of 4 in “[Bug Report] git log -L:<funcname>:<file>”
  1. Weishi ZengMay 20, 2021
  2. Bagas SanjayaMay 20, 2021
  3. Weishi ZengMay 20, 2021
  4. Atharva RaykarMay 20, 2021

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.