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

Re: git blame --ignore-rev does not work

From
HMHarrison McCullough <mccullough.harrison@gmail.com>
Date
Oct 2, 2020, 22:52 UTC
Message-ID
<CAHLeu+zSaTwPEDQ=CuFua0NdEppM+OjFaREU+Yiy9udK1OUK4w@mail.gmail.com>
In-Reply-To
<3e9b34f9-f61e-f3f1-45a3-6352641e434a@google.com>

Thank you for your feedback! I do have some more information to provide that is confusing.

I tried running `git blame -w`, and this correctly ignores the revision I tried to ignore with `--ignore-rev`, etc. So it appears that the algorithm to attribute lines to commits is capable of ignoring the commit in question (in the lines I've inspected) but it's not doing it when I use the "ignore-rev" capability—only the "ignore whitespace changes" capability.

Does anyone have any ideas about why that may be the case? Does the "ignore whitespace" and "ignore commit" algorithms use different logic? I would have assumed that they shared most of the logic.

I would love to provide a concrete example, but the only time I've been able to reproduce this is with proprietary code. I'll try to create a new repository with a similar commit and see if I can ignore it there.

For the information of those interested, the commit I'm trying to ignore is a "reformat the world" commit. We introduced the tool "astyle" into our codebase, and as part of that effort I ran astyle over our entire codebase.

Is it possible that the commit isn't being ignored because it's too big? It did change over 1300 files....

On Fri, Oct 2, 2020 at 4:44 PM Barret Rhoden <brho@google.com> wrote:
Show 43 quoted lines
>
> Hi -
>
> On 10/2/20 5:40 PM, René Scharfe wrote:
> [snip]
> > I don't know if these revisions are not ignored due to bugs or because
> > the feature just isn't strong enough, yet, but I would expect your
> > particular case to be represented by at least one of these...
>
> Correct.
>
> When skipping a revision, the algorithm attempts to find another
> revision that could be responsible for the change.  But it might not be
> able to find anything.  Consider a commit that just adds a few lines to
> a file with only 'foo' and 'bar':
>
> commit: "Adding Lines"
> -------------
>   foo
> +No commit
> +ever touched
> +these lines
>   bar
>
> If we ignored that revision, which commit do we assign those lines to?
> If they were "similar" to the existing lines, then the algorithm might
> match.  But in general, we can't find 'correct' (as defined by a user)
> matches for arbitrary changes.
>
> I usually run git with these settings:
>
> [blame]
>          ignorerevsfile = .git-blame-ignore-revs
>          markIgnoredLines = true
>          markUnblamableLines = true
>
> Which points out when --ignore-revs is doing something.
>
> Thanks,
>
> Barret
>
>
-- 
-Harrison McCullough
Previous: Barret RhodenNext: Barret Rhoden
Message 4 of 5 in “git blame --ignore-rev does not work”
  1. Harrison McCulloughSep 30, 2020
  2. René ScharfeOct 2, 2020
  3. Barret RhodenOct 2, 2020
  4. Harrison McCulloughOct 2, 2020
  5. Barret RhodenOct 3, 2020

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.