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

Re: Ignored commits appearing in git blame

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 9, 2023, 04:35 UTC
Message-ID
<xmqq5ydgwcj9.fsf@gitster.g>
In-Reply-To
<b1051e73-e663-82bf-bda6-015e64102248@trigofacile.com>
Julien ÉLIE <julien@trigofacile.com> writes:
[jc: redirecting to those who touched "blame-ignore" topic in the past]
Show 64 quoted lines
> Hi all,
>
> I'm facing an issue with the use of "git blame" which shows commits marked to be ignored.
>
> We have a .git-blame-ignore-revs file that can be retrievable at <https://github.com/InterNetNews/inn/blob/main/.git-blame-ignore-revs>.
>
> The Git command line I'm using is:
>     git blame --ignore-revs-file .git-blame-ignore-revs radius.c
>
> Here is an extract where commit 36944f2b16 appears at line 59, though it should be ignored (present in .git-blame-ignore-revs):
>
> 8e3e288fec (Marc G. Fournier   1998-12-29 13:19:05 +0000  50)     int radport;
> 8e3e288fec (Marc G. Fournier   1998-12-29 13:19:05 +0000  51)     char *lochost;
> a9d899ddbe (Russ Allbery       1999-11-29 01:40:47 +0000  52)     int locport;
> 8e3e288fec (Marc G. Fournier   1998-12-29 13:19:05 +0000  53)
> 8e3e288fec (Marc G. Fournier   1998-12-29 13:19:05 +0000  54)     char *prefix, *suffix; /* futz with the username, if necessary */
> 9f21a39f37 (Katsuhiro Kondou   1999-06-12 09:33:48 +0000  55)     int ignore_source;
> d65e228465 (Jeffrey M. Vinocur 2002-03-14 07:27:00 +0000  56)
> d65e228465 (Jeffrey M. Vinocur 2002-03-14 07:27:00 +0000  57)     struct _rad_config_t *next; /* point to any additional servers */
> 8e3e288fec (Marc G. Fournier   1998-12-29 13:19:05 +0000  58) } rad_config_t;
> 36944f2b16 (Julien ÉLIE        2021-10-31 10:04:59 +0100  59)
> d65e228465 (Jeffrey M. Vinocur 2002-03-14 07:27:00 +0000  60) typedef struct _sending_t {
> d65e228465 (Jeffrey M. Vinocur 2002-03-14 07:27:00 +0000  61)     auth_req req;
> d65e228465 (Jeffrey M. Vinocur 2002-03-14 07:27:00 +0000  62)     int reqlen;
>
>
> When running git blame without ignoring revisions, commit 36944f2b16 appears at lines 54, 57 and 59:
>
> 8e3e288fec (Marc G. Fournier   1998-12-29 13:19:05 +0000  50)     int radport;
> 8e3e288fec (Marc G. Fournier   1998-12-29 13:19:05 +0000  51)     char *lochost;
> a9d899ddbe (Russ Allbery       1999-11-29 01:40:47 +0000  52)     int locport;
> 8e3e288fec (Marc G. Fournier   1998-12-29 13:19:05 +0000  53)
> 36944f2b16 (Julien ÉLIE        2021-10-31 10:04:59 +0100  54)     char *prefix, *suffix; /* futz with the username, if necessary */
> 9f21a39f37 (Katsuhiro Kondou   1999-06-12 09:33:48 +0000  55)     int ignore_source;
> d65e228465 (Jeffrey M. Vinocur 2002-03-14 07:27:00 +0000  56)
> 36944f2b16 (Julien ÉLIE        2021-10-31 10:04:59 +0100  57)     struct _rad_config_t *next; /* point to any additional servers */
> 8e3e288fec (Marc G. Fournier   1998-12-29 13:19:05 +0000  58) } rad_config_t;
> 36944f2b16 (Julien ÉLIE        2021-10-31 10:04:59 +0100  59)
> d65e228465 (Jeffrey M. Vinocur 2002-03-14 07:27:00 +0000  60) typedef struct _sending_t {
> d65e228465 (Jeffrey M. Vinocur 2002-03-14 07:27:00 +0000  61)     auth_req req;
> d65e228465 (Jeffrey M. Vinocur 2002-03-14 07:27:00 +0000  62)     int reqlen;
>
>
> Shouldn't 36944f2b16 have disappeared from the output at line 59?
>
> It should have been d65e228465 which already had that line, as it can be seen in the commit (line 53 at that time):
>   https://github.com/InterNetNews/inn/blob/d65e228465700ff044b75aecacb7062d2a1250f9/authprogs/radius.c
>
>
> The result of that command is the same as the one GitHub shows; you can therefore find the whole ouput here:
>
>     https://github.com/InterNetNews/inn/blame/main/authprogs/radius.c
>
> Commit 36944f2b16 is mentioned at lines 59, 129, 144, 293, etc. though present in .git-blame-ignore-revs.
> Yet, that very commit is correctly ignored at other places of the same file.
>
> Other files and other commits in the project are also affected.  I can give more examples if needed.
>
>
> Is it the expected behaviour of "git blame"?
> Is there a reason for these commits to appear in some portions of the blame output?
>
>
> Thanks beforehand,
Previous: Julien ÉLIENext: Michael Platings
Message 2 of 4 in “Ignored commits appearing in git blame”
  1. Julien ÉLIEJan 8, 2023
  2. Junio C HamanoJan 9, 2023
  3. Michael PlatingsJan 9, 2023
  4. Julien ÉLIEJan 10, 2023

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.