Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Jeff King <>
To: Johannes Sixt <>
Cc: Sam Clymer <>,
Subject: Re: Bug in git log -S
Date: Wed, 15 May 2024 02:34:00 -0400	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Mon, May 13, 2024 at 11:01:25PM +0200, Johannes Sixt wrote:

> Am 13.05.24 um 20:58 schrieb Sam Clymer:
> > There does seem to be a bug on my end. I am searching for
> > “net8.0-windows” and it’s not finding an instance where it’s added.
> > It is not a line of code that is moved around it is purely added so I
> > think there is indeed something wrong with git log -S.
> You would have to show more evidence for a bug before anything can
> happen. Start with showing the commands typed and their output, ideally
> you point at a commit history that shows the problem, etc. Otherwise, we
> can only say: "it works here".

I agree that we do not have much to go on here, but here are some
possible lines of enquiry:

  - if we have a specific commit that we expect "-S" to find, what does
    that commit look like? Is it a merge commit? If so, then maybe "-m"
    or "-c" would help? By default I don't think "log -S" will diff
    merges at all. "-m" will diff against both parents (so it is more
    likely to find introductions/deletions, but may show diffs against
    both parents). "-c" should I think mostly show just places where the
    content was introduced by the merge itself, though I haven't thought
    very hard on whether there are weird corner cases.

  - if there's a non-merge commit that we expect to find it in, then
    maybe checking:

      git cat-file blob $commit:$file | grep -Fc net8.0-windows
      git cat-file blob $commit^:$file | grep -Fc net8.0-windows

    would verify that the counts before/after that commit have changed?
    Note that "-F" is important, because -S is by default a string
    match, not a regex. And if the suspected file is binary, then the
    results may depend on your version of grep (GNU grep will correctly
    report the count for items in a binary file).


      reply	other threads:[~2024-05-15  6:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-13  1:40 Bug in git log -S Sam Clymer
2024-05-13  5:55 ` Johannes Sixt
2024-05-13 18:58   ` Sam Clymer
2024-05-13 21:01     ` Johannes Sixt
2024-05-15  6:34       ` Jeff King [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).