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

Re: [PATCH] blame: add the ability to ignore commits

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 15, 2019, 06:08 UTC
Message-ID
<xmqqd0oytpv2.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<003c01d4ac36$bdf29470$39d7bd50$@nexbridge.com>
"Randall S. Becker" <rsbecker@nexbridge.com> writes:
Show 31 quoted lines
> On January 14, 2019 12:46, Junio C Hamano wrote:
>> Barret Rhoden <brho@google.com> writes:
>> 
>> > On 2019-01-10 at 14:29 Junio C Hamano <gitster@pobox.com> wrote:
>> >> > For instance, commit X does this:
>> >> >
>> >> > -foo(x,y);
>> >> > +foo(x,y,z);
>> >> >
>> >> > Then commit Y comes along to reformat it:
>> >> >
>> >> > -foo(x,y,z);
>> >> > +foo(x, y, z);
>> >> >
>> >> > And the history / rev-list for the file looks like:
>> >> >
>> >> > ---O---A---X---B---C---D---Y---E---F
>> >> >
>> >> > I want to ignore/skip Y and see X in the blame output.
>> >>
>> >> If you skip Y, the altered history would have "foo(x, y, z)" in E,
>> >> "foo(x,y,z)" in X, and "foo(x,y)" in A.  If you start blaming from F,
>> >> you'd get E as the commit that explains the latest state.  If you do
>> >> not skip Y, you'd get Y.  I am not sure how you'd get X in either
>> >> case.
>> >
>> ...
>
> From my own community, this came up also. The intent was to show everyone
> who touched a particular line, throughout history, not just the current one.
> Perhaps that is what Barret is going for.

I think I now understand what is going on. In short, what Barret wanted is way more ambitious than "blame in a hypothetical history that lacks certain commits". There is no similiarity with existing "-S <revs>" option that I asked about in my initial review. This is quite a different beast (and I kind-a like it ;-).

Instead of "skipping" Y, Barret wants to pretend that the effect of commit Y, in addition to the commit Y itself, never existed in the history. Even when blaming back from F (where it has "foo(x, y, z)", which is the same as E and down to Y), the algorithm wants to pretend as if E and F had that line in "foo(x,y,z)" form, i.e. before Y touched it, and also pretend that the user started blaming a line in that shape.

As there is no general solution [*1*] to "how did this line looked like before this commit", such a blame may not have a meaningful answer. When Y added a block of text without removing anything (i.e. "git show Y" has no line that begins with '-'), and when the user asked to blame that block of text in F, there is no sensible answer to the question: "what got replaced by Y in this text?", so a blame that "ignores" Y would not be able to answer "where did these lines come from?" question. But in some cases (e.g. when "git show Y" has only one '-' line, immediately followed by '+' line, both with quite a similar contents and no other change in the patch---it is highly plausible that in such a change, the former became the latter, like the example in Barret's message I was responding to), we can say "this was how the line that was modified in Y looked like before Y" and blaming while ignoring Y can have a reasonable answer.

[Footnote]

*1* Here, I use the word "solution" in the same sense as "solution to a math equation", not in the sense to describe the steps to derive that "solution".

Previous: Barret RhodenNext: Stefan Beller
Message 11 of 39 in “blame: add the ability to ignore commits”
  1. blame: add the ability to ignore commitsBarret Rhoden, Jan 7, 2019
  2. Junio C HamanoJan 7, 2019
  3. Barret RhodenJan 8, 2019
  4. Junio C HamanoJan 8, 2019
  5. Barret RhodenJan 9, 2019
  6. Junio C HamanoJan 10, 2019
  7. Barret RhodenJan 14, 2019
  8. Junio C HamanoJan 14, 2019
  9. Randall S. BeckerJan 14, 2019
  10. Barret RhodenJan 14, 2019
  11. Junio C HamanoJan 15, 2019
  12. Stefan BellerJan 9, 2019
  13. Ævar Arnfjörð BjarmasonJan 8, 2019
  14. Barret RhodenJan 8, 2019
  15. Barret RhodenJan 8, 2019
  16. 0/3 blame: add the ability to ignore commitsBarret Rhoden, Jan 17, 2019
  17. 2/3 blame: add the ability to ignore commits and their changesBarret Rhoden, Jan 17, 2019
  18. Johannes SchindelinJan 18, 2019
  19. Barret RhodenJan 18, 2019
  20. René ScharfeJan 20, 2019
  21. Barret RhodenJan 22, 2019
  22. Junio C HamanoJan 22, 2019
  23. Barret RhodenJan 22, 2019
  24. Junio C HamanoJan 23, 2019
  25. Barret RhodenFeb 1, 2019
  26. 3/3 blame: add a config option to mark ignored linesBarret Rhoden, Jan 17, 2019
  27. Johannes SchindelinJan 18, 2019
  28. 1/3 Move init_skiplist() outside of fsckBarret Rhoden, Jan 17, 2019
  29. Johannes SchindelinJan 18, 2019
  30. Ævar Arnfjörð BjarmasonJan 18, 2019
  31. Junio C HamanoJan 18, 2019
  32. Johannes SchindelinJan 18, 2019
  33. Jeff KingJan 18, 2019
  34. Ævar Arnfjörð BjarmasonJan 18, 2019
  35. Jeff KingJan 22, 2019
  36. Ævar Arnfjörð BjarmasonJan 22, 2019
  37. Junio C HamanoJan 22, 2019
  38. Jeff KingJan 22, 2019
  39. Ævar Arnfjörð BjarmasonJan 18, 2019

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.