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

git-rebase is ignoring working-tree-encoding

From
ABAdrián Gimeno Balaguer <adrigibal@gmail.com>
Date
Nov 2, 2018, 02:30 UTC
Message-ID
<CADN+U_PUfnYWb-wW6drRANv-ZaYBEk3gWHc7oJtxohA5Vc3NEg@mail.gmail.com>

I’m attempting to perform fixups via git-rebase of UTF-16 LE files (the project I’m working on requires that exact encoding on certain files). When the rebase is complete, Git changes that file’s encoding to UTF-16 BE. I have been using the newer working-tree-encoding attribute in .gitattributes. I’m using Git for Windows.

$ git version git version 2.19.1.windows.1

Here is a sample UTF-16 LE file (with BOM and LF endings) with following atributes in .gitattributes:

test.txt eol=lf -text working-tree-encoding=UTF-16

I put eol=lf and -text to tell Git to not change the encoding of the file on checkout, but that doesn’t even help. Asides, the newer working-tree-encoding allows me to view human-readable diffs of that file (in GitHub Desktop and Git Bash). Now, note that doing for example consecutive commits to the same file does not affect the UTF-16 LE encoding. And before I discovered this attribute, the whole thing was even worse when squash/fixup rebasing, as Git would modify the file with Chinese characters (when manually setting it as text via .gitattributes).

So, again the problem with the exposed .gitattributes line is that after fixup rebasing, UTF-16 LE files encoding change to UTF-16 BE.

For long, I have been working with the involved UTF-16 LE files set as binary via .gitattributes (e.g. “test.txt binary”), so that Git would not modify the file encoding, but this doesn’t allow me to view the diffs upon changes in GitHub Desktop, which I want (and neither via git diff).

Next: brian m. carlson
Message 1 of 25 in “git-rebase is ignoring working-tree-encoding”
  1. Adrián Gimeno BalaguerNov 2, 2018
  2. brian m. carlsonNov 4, 2018
  3. Adrián Gimeno BalaguerNov 4, 2018
  4. brian m. carlsonNov 4, 2018
  5. Torsten BögershausenNov 4, 2018
  6. Adrián Gimeno BalaguerNov 5, 2018
  7. Torsten BögershausenNov 5, 2018
  8. Torsten BögershausenNov 6, 2018
  9. Adrián Gimeno BalaguerNov 7, 2018
  10. Torsten BögershausenNov 8, 2018
  11. Alexandre GrigorievDec 26, 2018
  12. brian m. carlsonDec 26, 2018
  13. Alexandre GrigorievDec 27, 2018
  14. Torsten BögershausenDec 27, 2018
  15. Alexandre GrigorievDec 23, 2018
  16. 1/1 Support working-tree-encoding "UTF-16LE-BOM"tboegi@web.de, Dec 29, 2018
  17. 1/1 Support working-tree-encoding "UTF-16LE-BOM"tboegi@web.de, Jan 20, 2019
  18. Junio C HamanoJan 22, 2019
  19. 1/1 Support working-tree-encoding "UTF-16LE-BOM"tboegi@web.de, Jan 30, 2019
  20. Jason PyeronJan 30, 2019
  21. Torsten BögershausenJan 30, 2019
  22. 1/1 gitattributes.txt: fix typotboegi@web.de, Mar 6, 2019
  23. Junio C HamanoMar 7, 2019
  24. Adrián Gimeno BalaguerDec 29, 2018
  25. Philip OakleyDec 29, 2018

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.