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

Re: Suggested clarification for .gitattributes reference documentation

From
Torsten Bögershausen <tboegi@web.de>
Date
Jan 16, 2024, 17:44 UTC
Message-ID
<20240116174400.GA2353@tb-raspi4>
In-Reply-To
<ZaXkt715TjNpuprG@tapette.crustytoothpaste.net>
On Tue, Jan 16, 2024 at 02:06:47AM +0000, brian m. carlson wrote:
Show 13 quoted lines
> On 2024-01-16 at 00:19:20, Michael Litwak wrote:
> > As for documentation clarifications for the .gitattributes manpage at
> > https://git-scm.com/docs/gitattributes, I still suggest adding an
> > explicit example for UTF-16LE with BOM, and/or adding a table listing
> > which working-tree-encoding value to use for each of the following
> > UTF-16 text encodings:
> >
> > ENCODING              'working-tree-encoding' VALUE
> > -------------------   -----------------------------
> > UTF-16LE with BOM     UTF-16LE-BOM
>
> I should point out that this encoding, while very common on Windows, is
> also nonstandard.

In general, I agree with everything that is snipped, thanks for the ong wordings. []

> (Apparently Emacs, which is not on my system, may
> permit that, which does not surprise me in the least.)
emacs seems to handle UTF-16LE-BOM just fine.
>
> > UTF-16BE with BOM     UTF-16
>
[]
Show 9 quoted lines
> I think the addition of this table is too much.  UTF-16LE-BOM is common
> on Windows, and the rest are substantially less common.  It's also very
> difficult to explain in a table what "UTF-16" means in an understandable
> way.  And I also think it's also pretty clear that users should be using
> UTF-8 without BOM where possible.
>
> We do already mention both UTF-16, UTF-16LE, and UTF-16LE-BOM as options
> in the gitattributes manual page, and it's up to the user to know what
> their program wants and supports if that's not UTF-8.

What exactly is missing in the documentation ? Could you please try to send us a diff (or even better a patch), so that we can get an idea, of what can be improved ? From my reading UTF-16LE-BOM is already mentioned. It would be nice to see (from a user), what is probably missing.

Show 13 quoted lines
> > Finally, I am not sure how to use git add --renormalize to correct a
> > UTF-16 file that was previously added incorrectly (i.e. with a missing
> > or incorrect working-tree-encoding entry in .gitattributes).  The git
> > add documentation at https://git-scm.com/docs/git-add implies
> > 'renormalize' resets only the end-of-line values; however, I suspect
> > it also re-converts text encoding when a working-tree-encoding
> > property is set.  It would be helpful to know one way or the other.
>
> It does indeed affect the working-tree-encoding.  If you wanted to send
> an inline patch created with git format-patch, it would probably be
> welcome to mention that.  However, because in this project we typically
> scratch our own itch, if you don't send one, it's likely nobody else
> will, either.

For the record: It will even run the "clean" filter, if it has changed, or being freshly enabled. So yes, a patch would be appreciated.

Thanks for bringing this up.
Previous: brian m. carlson
Message 10 of 10 in “Suggested clarification for .gitattributes reference documentation”
  1. Michael LitwakJan 12, 2024
  2. brian m. carlsonJan 12, 2024
  3. Michael LitwakJan 12, 2024
  4. Michael LitwakJan 13, 2024
  5. Torsten BögershausenJan 13, 2024
  6. Matthias AßhauerJan 13, 2024
  7. Johannes SchindelinFeb 18, 2024
  8. Michael LitwakJan 16, 2024
  9. brian m. carlsonJan 16, 2024
  10. Torsten BögershausenJan 16, 2024

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.