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

Re: git log -S not finding all commits?

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Oct 8, 2009, 11:40 UTC
Message-ID
<vpqbpkixgea.fsf@bauges.imag.fr>
In-Reply-To
<362436ca.6b5d0fc3.4acdc7e1.41b23@o2.pl>
Daniel <mjucde@o2.pl> writes:
Show 17 quoted lines
> Andreas Ericsson <ae@op5.se> wrote:
>
>> Yes, it's the correct behaviour. -S finds only lines where what you search
>> for was added or deleted. It counts the number of occurrences of what you
>> specify in each resulting tree and only shows the commits where that number
>> changed. In your case, searching for "Free data " would have printed both
>> commits, since you first introduce that entire string and then remove it.
>
> Thanks. However, your suggestion doesn't work. It prints only commit 2. Maybe
> you meant:
>
> $ PAGER=cat git log --pickaxe-regex -S'Free data$' --oneline
>
> but that doesn't solve my problem. I want to find all commits which changed
> lines containing "Free data" (the example I posted is simplified).
>
> Seems I have to use "git log -p" and search its output using pager...

Search the ML's archives, this is a FAQ. People have proposed an option to allow log -S to actually search the diff (much slower, but sometimes what you really want), but AFAIK, no one wrote the code. But I think someone posted a small perl script along the lines of

git log -p --format="%s\n%x00"  | perl -0 -ne 'print if(/whatever-you-search/);'
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: DanielNext: Matthieu Moy
Message 4 of 15 in “git log -S not finding all commits?”
  1. DanielOct 8, 2009
  2. Andreas EricssonOct 8, 2009
  3. DanielOct 8, 2009
  4. Matthieu MoyOct 8, 2009
  5. Matthieu MoyOct 8, 2009
  6. DanielOct 8, 2009
  7. Matthieu MoyOct 8, 2009
  8. Randal L. SchwartzOct 8, 2009
  9. Matthieu MoyOct 9, 2009
  10. Scott WiersdorfOct 9, 2009
  11. Randal L. SchwartzOct 9, 2009
  12. Matthieu MoyOct 9, 2009
  13. Randal L. SchwartzOct 9, 2009
  14. Scott WiersdorfOct 9, 2009
  15. Nanako ShiraishiOct 8, 2009

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.