git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Ignored commits appearing in git blame
@ 2023-01-08  9:27 Julien ÉLIE
  2023-01-09  4:35 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Julien ÉLIE @ 2023-01-08  9:27 UTC (permalink / raw)
  To: git

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,

-- 
Julien ÉLIE

« – Cet homme qui est sorti du palais, nous renseignera peut-être sur la
     façon d'y entrer. Suivons-le.
   – Mais… Il sait sortir d'accord, mais rien ne prouve qu'il sache
     entrer, et… » (Astérix)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ignored commits appearing in git blame
  2023-01-08  9:27 Ignored commits appearing in git blame Julien ÉLIE
@ 2023-01-09  4:35 ` Junio C Hamano
  2023-01-09 13:26   ` Michael Platings
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2023-01-09  4:35 UTC (permalink / raw)
  To: Julien ÉLIE, Barret Rhoden, Michael Platings; +Cc: git

Julien ÉLIE <julien@trigofacile.com> writes:

[jc: redirecting to those who touched "blame-ignore" topic in the past]

> 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,

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ignored commits appearing in git blame
  2023-01-09  4:35 ` Junio C Hamano
@ 2023-01-09 13:26   ` Michael Platings
  2023-01-10 21:09     ` Julien ÉLIE
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Platings @ 2023-01-09 13:26 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Julien ÉLIE, Barret Rhoden, git

(Resending. The anti-HTML filter gets me every time)
Thanks Junio for forwarding.
Hi Julien,
You're right, ideally 36944f2b16 should have disappeared from the
output at line 5. The way the ignoring algorithm works is that it
tries to find a line in the previous commit with similar content.
Since there's so little content to compare I guess the algorithm plays
it safe and gives up. On the one hand this is annoying because an
empty line or single curly brace should be trivial for the algorithm
to deal with. On the other hand "which change caused this empty line
to be here?" is not a very interesting question so hopefully won't be
too much of a problem for you in practice.
Thanks for bringing it to my attention. There are a couple of
annoyances with the feature I'd like to fix (the main being that
there's no way to enable it globally) and I'll add this to the list.
However I'm unlikely to get to it soon. I won't complain if you beat
me to fixing it :)
-Michael


On Mon, 9 Jan 2023 at 04:35, Junio C Hamano <gitster@pobox.com> wrote:
>
> Julien ÉLIE <julien@trigofacile.com> writes:
>
> [jc: redirecting to those who touched "blame-ignore" topic in the past]
>
> > 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,

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ignored commits appearing in git blame
  2023-01-09 13:26   ` Michael Platings
@ 2023-01-10 21:09     ` Julien ÉLIE
  0 siblings, 0 replies; 4+ messages in thread
From: Julien ÉLIE @ 2023-01-10 21:09 UTC (permalink / raw)
  To: Michael Platings; +Cc: Barret Rhoden, git

Hi Michael,

Thanks for having taken time to respond!

> You're right, ideally 36944f2b16 should have disappeared from the
> output at line 5. The way the ignoring algorithm works is that it
> tries to find a line in the previous commit with similar content.
> Since there's so little content to compare I guess the algorithm plays
> it safe and gives up.

OK, I understand.


> On the one hand this is annoying because an
> empty line or single curly brace should be trivial for the algorithm
> to deal with. On the other hand "which change caused this empty line
> to be here?" is not a very interesting question so hopefully won't be
> too much of a problem for you in practice.

I agree.


> There are a couple of
> annoyances with the feature I'd like to fix (the main being that
> there's no way to enable it globally) and I'll add this to the list.
> However I'm unlikely to get to it soon. I won't complain if you beat
> me to fixing it :)

Thanks for having considered the bug report.
In case it helps, I've noticed that if I add the "-w" flag (to ignore 
whitespace in comparisons), the git blame output no longer shows that 
revision which was asked to be ignored.

   git blame -w --ignore-revs-file .git-blame-ignore-revs radius.c

I don't know whether it is a coincidence (especially when 
.git-blame-ignore-revs contains in fact commits of code reformatting and 
whitespace cleaning) or it would also help for other kind of commits to 
ignore.

-- 
Julien ÉLIE

« Le bonheur, c'est de continuer à désirer ce que l'on possède. »
   (Saint-Augustin)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-10 21:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-08  9:27 Ignored commits appearing in git blame Julien ÉLIE
2023-01-09  4:35 ` Junio C Hamano
2023-01-09 13:26   ` Michael Platings
2023-01-10 21:09     ` Julien ÉLIE

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).