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

Re: [PATCH v2] blame: print unblamable and ignored commits in porcelain mode

From
Karthik Nayak <karthik.188@gmail.com>
Date
Mar 29, 2025, 10:26 UTC
Message-ID
<CAOLa=ZRgAQ+FKznxOaOe0ou_6vRPOA7SorhxwvGeBZ07SasgqA@mail.gmail.com>
In-Reply-To
<Z-ZI-M2jBf5pqMoA@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 20 quoted lines
> On Wed, Mar 26, 2025 at 10:06:10PM +0100, Karthik Nayak wrote:
>> diff --git a/builtin/blame.c b/builtin/blame.c
>> index c470654c7e..528bfef249 100644
>> --- a/builtin/blame.c
>> +++ b/builtin/blame.c
>> @@ -351,6 +351,19 @@ static void emit_porcelain_details(struct blame_origin *suspect, int repeat)
>>  		write_filename_info(suspect);
>>  }
>>
>> +/*
>> + * Information which needs to be printed per-line goes here. Any
>> + * information which can be clubbed on a commit/file level, should
>> + * be printed via 'emit_one_suspect_detail()'.
>> + */
>> +static void emit_per_line_details(struct blame_entry *ent)
>
> Tiny nit, feel free to ignore: should this something like
> `emit_porcelain_per_line_details()` to highlight that this is part of
> the porcelain format?
>
That's a great point, will add that in.
Show 11 quoted lines
>> +{
>> +	if (mark_unblamable_lines && ent->unblamable)
>> +		printf("unblamable\n");
>> +	if (mark_ignored_lines && ent->ignored)
>> +		printf("ignored\n");
>> +}
>> +
>
> Another tiny nit: you may use `puts()` instead of `printf()`. I don't
> mind it much though, both versions work equally well.
>

Yeah, I think some compilers also do this translation. But I'll change it as anyways I'm going to push a new version.

Show 25 quoted lines
>> diff --git a/t/t8013-blame-ignore-revs.sh b/t/t8013-blame-ignore-revs.sh
>> index 370b768149..306fc61057 100755
>> --- a/t/t8013-blame-ignore-revs.sh
>> +++ b/t/t8013-blame-ignore-revs.sh
>> @@ -158,6 +158,16 @@ test_expect_success mark_unblamable_lines '
>>  	test_cmp expect actual
>>  '
>>
>> +for opt in --porcelain --line-porcelain
>> +do
>> +	test_expect_success 'mark_unblamable_lines with $opt' '
>> +		sha=$(git rev-parse Y) &&
>> +
>> +		git -c blame.markUnblamableLines=true blame $opt --ignore-rev Y file >actual &&
>> +		test $(grep ^unblamable actual | wc -l) -eq 2
>> +	'
>> +done
>> +
>
> Okay, makes sense. We cannot batch the information on the first time
> we've seen the commit here because both the "unblamable" and "ignored"
> properties are properties of the line, not of the commit. So we'd expect
> to see the information per line in both modes.
>
> Patrick

Thanks for the review. Karthik

Previous: Patrick SteinhardtNext: Karthik Nayak
Message 16 of 28 in “blame: fix unblamable and ignored lines in porcelain mode”
  1. blame: fix unblamable and ignored lines in porcelain modeKarthik Nayak, Mar 21, 2025
  2. Junio C HamanoMar 23, 2025
  3. Patrick SteinhardtMar 24, 2025
  4. Toon ClaesMar 24, 2025
  5. Karthik NayakMar 24, 2025
  6. Toon ClaesMar 25, 2025
  7. Karthik NayakMar 25, 2025
  8. Junio C HamanoMar 25, 2025
  9. Karthik NayakMar 24, 2025
  10. Karthik NayakMar 24, 2025
  11. blame: print unblamable and ignored commits in porcelain modeKarthik Nayak, Mar 26, 2025
  12. Eric SunshineMar 26, 2025
  13. Karthik NayakMar 27, 2025
  14. Junio C HamanoMar 29, 2025
  15. Patrick SteinhardtMar 28, 2025
  16. Karthik NayakMar 29, 2025
  17. blame: print unblamable and ignored commits in porcelain modeKarthik Nayak, Mar 29, 2025
  18. Junio C HamanoMar 30, 2025
  19. Phillip WoodMar 30, 2025
  20. blame: print unblamable and ignored commits in porcelain modeKarthik Nayak, Mar 30, 2025
  21. Patrick SteinhardtMar 31, 2025
  22. Karthik NayakMar 31, 2025
  23. phillip.wood123@gmail.comMar 31, 2025
  24. Phillip WoodMar 31, 2025
  25. blame: print unblamable and ignored commits in porcelain modeKarthik Nayak, Apr 3, 2025
  26. Phillip WoodApr 4, 2025
  27. Junio C HamanoApr 8, 2025
  28. Phillip WoodApr 2, 2025

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.