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

Re: Potential bug: Git instantly converts utf-8-bom to utf-8

From
Torsten Bögershausen <tboegi@web.de>
Date
Apr 14, 2025, 18:03 UTC
Message-ID
<20250414180338.GA2398@tb-raspi4>
In-Reply-To
<A743D2B5-0397-4AF3-899B-FC3D3AD2B5CB@gmail.com>
On Mon, Apr 14, 2025 at 02:19:05PM -0300, Lucas Seiki Oshiro wrote:
Show 40 quoted lines
>
> > When I clone the git repository https://github.com/NinekoTheCat/infinilore.cs.git into an empty directory and run git status it shows changes where all the files are deleted and then added again.
>
> I tried here. I'm in a Mac, it shows that several file changes.
>
> > The difference seems to be in the first line as opening it in a text editor aware of encodings shows the change from utf-8-bom to utf-8.
>
> Given the warning messages it looks like it is more related
> to CRLF/LF than to UTF-8.
>
> At least here, for example, the listed modified '*.cs' files
> are the ones that ends their lines in CRLF. This is, running:
>
> ```
> file $(git ls-files '*.cs') | grep CRLF | cut -d ':' -f1 | sort
> ```
>
> shows me the same files as
>
> ```
> git status '*.cs'
> ```
>
> You can also see that are some '*.cs' files that are not
> CRLF-terminated by running:
>
> ```
> file $(git ls-files '*.cs') | grep -v CRLF | sort
> ```
>
> > I'd be very very grateful if anyone could explain what's going on and have a solution.<patch.cat>
>
> Perhaps a solution is:
>
> - Define a CRLF or LF as a standard
> - Convert all the files that don't follow the standard that you
>   have chosen to the one that you have chosen
> - Declare it in the .gitattributes file
>
> Hope that it helps you!

I think that this is already done :-) However, the repo must be normalized:

git add --renormalize .
will do that.
Previous: Lucas Seiki OshiroNext: Junio C Hamano
Message 3 of 4 in “Potential bug: Git instantly converts utf-8-bom to utf-8”
  1. messesterApr 14, 2025
  2. Lucas Seiki OshiroApr 14, 2025
  3. Torsten BögershausenApr 14, 2025
  4. Junio C HamanoApr 14, 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.