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

Re: [PATCH v3 0/7] convert: add support for different encodings

From
Torsten Bögershausen <tboegi@web.de>
Date
Jan 8, 2018, 18:08 UTC
Message-ID
<20180108180826.GA16999@tor.lan>
In-Reply-To
<B51940E6-95AB-424A-AF62-0018E9934279@gmail.com>

On Mon, Jan 08, 2018 at 03:38:48PM +0100, Lars Schneider wrote: []

Show 23 quoted lines
> > Some comments:
> > 
> > I would like to have the CRLF conversion a little bit more strict -
> > many users tend to set core.autocrlf=true or write "* text=auto"
> > in the .gitattributes.
> > Reading all the effort about BOM markers and UTF-16LE, I think there
> > should ne some effort to make the line endings round trip.
> > Therefore I changed convert.c to demand that the "text" attribute
> > is set to enable CRLF conversions.
> > (If I had submitted the patch, I would have demanded
> > "text eol=lf" or "text eol=crlf", but the test case t0028 indicates
> > that there is a demand to produce line endings as configured in core.eol)
> 
> But wouldn't that be inconvenient for the users? E.g. if I add a UTF-16
> file on Windows with CRLF then it would be nice if Git would automatically
> convert the line endings to LF on Linux, no?
> 
> IOW: Why should we handle text files that have a defined checkout-encoding
> differently compared to UTF-8 encoded text files? Wouldn't that be unexpected
> to the user?
> 
> Thanks,
> Lars

The problem is, if user A has core.autocrlf=true and user B core.autocrlf=false. (The line endings don't show up as expected at user B)

Having said that in all shortness, you convinced me: If text=auto, we care about line endings. If text, we care about line endings.

If the .gitattributes don't say anything about text, we don't convert eol. (In other words: we don't look at core.autocrlf, when checkout-encoding is defined)

A new branch is push to github/tboegi
Previous: Lars Schneider
Message 15 of 15 in “convert: add support for different encodings”
  1. 0/7 convert: add support for different encodingslars.schneider@autodesk.com, Jan 6, 2018
  2. 1/7 strbuf: remove unnecessary NUL assignment in xstrdup_tolower()lars.schneider@autodesk.com, Jan 6, 2018
  3. 3/7 utf8: add function to detect prohibited UTF-16/32 BOMlars.schneider@autodesk.com, Jan 6, 2018
  4. 2/7 strbuf: add xstrdup_toupper()lars.schneider@autodesk.com, Jan 6, 2018
  5. 4/7 utf8: add function to detect a missing UTF-16/32 BOMlars.schneider@autodesk.com, Jan 6, 2018
  6. 5/7 convert_to_git(): safe_crlf/checksafe becomes int conv_flagslars.schneider@autodesk.com, Jan 6, 2018
  7. Junio C HamanoJan 8, 2018
  8. Lars SchneiderJan 8, 2018
  9. Junio C HamanoJan 8, 2018
  10. Torsten BögershausenJan 9, 2018
  11. 6/7 convert: add support for 'checkout-encoding' attributelars.schneider@autodesk.com, Jan 6, 2018
  12. 7/7 convert: add tracing for checkout-encodinglars.schneider@autodesk.com, Jan 6, 2018
  13. Torsten BögershausenJan 7, 2018
  14. Lars SchneiderJan 8, 2018
  15. Torsten BögershausenJan 8, 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.