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

Re: git log --encoding=HTML is not supported

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 26, 2021, 15:37 UTC
Message-ID
<xmqq5yvsgqt7.fsf@gitster.g>
In-Reply-To
<CAGyf7-FhLQKQyCOishyrZHg0J+jk6=aszE3hMoH=L0j+0+TP7Q@mail.gmail.com>
Bryan Turner <bturner@atlassian.com> writes:
Show 14 quoted lines
> On Wed, Aug 25, 2021 at 4:29 PM Krzysztof Żelechowski
> <giecrilj@stegny.2a.pl> wrote:
>>
>> Dnia środa, 25 sierpnia 2021 02:57:47 CEST Jeff King pisze:
>> > diff --git a/pretty.c b/pretty.c
>>
>> Please fix the manual for git log.  It should say what encoding is recognised
>> (namely if supported by iconv(1), except that POSIX character maps of
>> iconv(1p) are not supported), and that an unrecognised encoding is ignored.
>>
>> I would also like to see the HTML encoding supported independently of iconv,
>> which seems like a pretty easy thing to do.  Dream on, I guess?
>
> I suspect the answer is less "Dream on" and more "Patches welcome."

Patches are welcomed but not before a proposed design is freshed out. I am sure people do welcome the design discussion.

Pieces taken from the contents stored in Git (like "the title of the commit", "the name of the author of the commit") may need quoting and/or escaping when they are incorporated into a string to become parts of "output", and the way the quoting/escaping must be done would depend on the "host" language/format. HTML has its own requirements for how these pieces coming from Git contents are quoted, but it will not be the only "host" language that needs quoting.

The requirement for the feature we are "Dreaming on" may be much closer to the "host language" options (e.g. --tcl, --perl ...) the "git for-each-ref" command has. These options tells us to format each piece of information (e.g. "%(subject)") taken from Git as a natural 'string' constant in the host language, so that

	git for-each-ref --shell \
	    --format='do_something %(authorname) %(authoremail)'

would write a shell script that calls "do_something" command with two arguments for each ref enumerated by the command, without having to worry about whitespaces and quote characters that may appear in the interpolated pieces. It is immediately obvious that within the context of the for-each-ref command, the follwoing would equally be useful (note: this is already "dreaming on" and does not exist yet):

	echo "<ul>"
	git for-each-ref --html \
		--format='<li>%(authoremail)</li>'
	echo "</ul>"

As we have been seeing efforts to port features around the --format option between the for-each-ref family of commands and the log family of commands, I would also imagine that it would be natural future direction to extend it to the latter and eventually allow

	git log --html \
		--format='<tr><td>%h</td><td>%s</td>...</tr>'

to format each commit into a single row in HTML table, and things like that.

Previous: Bryan TurnerNext: Krzysztof Żelechowski
Message 29 of 33 in “git log --encoding=HTML is not supported”
  1. Krzysztof ŻelechowskiAug 24, 2021
  2. Bagas SanjayaAug 24, 2021
  3. Krzysztof ŻelechowskiAug 24, 2021
  4. Bagas SanjayaAug 24, 2021
  5. Junio C HamanoAug 24, 2021
  6. Jeff KingAug 25, 2021
  7. Junio C HamanoAug 25, 2021
  8. Jeff KingAug 27, 2021
  9. Jeff KingAug 27, 2021
  10. Junio C HamanoAug 27, 2021
  11. *Really* noisy encoding warnings post-v2.33.0Ævar Arnfjörð Bjarmason, Oct 9, 2021
  12. Ævar Arnfjörð BjarmasonOct 9, 2021
  13. Jeff KingOct 9, 2021
  14. Jeff KingOct 9, 2021
  15. Ævar Arnfjörð BjarmasonOct 9, 2021
  16. Jeff KingOct 27, 2021
  17. Ævar Arnfjörð BjarmasonOct 29, 2021
  18. Jeff KingOct 29, 2021
  19. Junio C HamanoOct 29, 2021
  20. Junio C HamanoOct 29, 2021
  21. Jeff KingOct 29, 2021
  22. Ævar Arnfjörð BjarmasonOct 22, 2021
  23. Johannes SixtOct 10, 2021
  24. Ævar Arnfjörð BjarmasonOct 10, 2021
  25. Krzysztof ŻelechowskiAug 25, 2021
  26. Jeff KingAug 27, 2021
  27. Krzysztof ŻelechowskiAug 25, 2021
  28. Bryan TurnerAug 25, 2021
  29. Junio C HamanoAug 26, 2021
  30. Krzysztof ŻelechowskiAug 26, 2021
  31. Junio C HamanoAug 27, 2021
  32. Jeff KingAug 27, 2021
  33. Junio C HamanoAug 27, 2021

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.