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

Re: mingw, windows, crlf/lf, and git

From
MLMark Levedahl <mlevedahl@verizon.net>
Date
Feb 13, 2007, 00:32 UTC
Message-ID
<45D10726.2070501@verizon.net>
In-Reply-To
<Pine.LNX.4.63.0702130020450.22628@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin wrote:
Show 24 quoted lines
> Hi,
>
> On Mon, 12 Feb 2007, Junio C Hamano wrote:
>
>   
>> I agree that we can assume editors can grok files with LF end-of-line 
>> just fine and we would not need to do the reverse conversion on checkout 
>> paths (e.g. "read-tree -u", "checkout-index").
>>     
>
> In that case, a simple pre-commit hook would suffice.
>
> No, the problem mentioned by Mark was a very real one: you _cannot_ rely 
> on Windows' editors not to fsck up with line endings. The worst case is if 
> the file contains _some_ CRLF and _some _LF_. Almost always I had the 
> problem that it now converted _all_ LFs to CRLFs. Even those which already 
> were converted.
>
> So, if we are to support text mode, it is not one-way. If we do one-way, 
> we really do _not_ support text mode, but pre-commit conversion to LF 
> style text. And in this case, core git does not need _any_ change.
>
> Ciao,
> Dscho

In my work flow, I am using a pre-commit script that (among other things) rewrites all text files to have \n endings. This is a one-way conversion, and does work well for the set of tools I am using. The converters I use I wrote years ago, and are smart enough to deal with mixtures of \n, \r\n, and \r line endings in one file, transforming all into one unified form. d2u / u2d were not that robust when I last tried them (years ago), but this is an absolute necessity.

However, I don't think the one-way conversion is acceptable across the board. While the only Windows editor I am aware of that doesn't grok \n is Notepad (the moral equivalent of edlin), I suspect that undo reliance upon this will still lead to grief. If nothing else, someone, somewhere will find that their beloved crlf's are missing and will complain. Loudly. And in the lore, git will become known for being "wierd." So, I suspect a checkout script is necessary.

Mark
Previous: Jeff KingNext: Junio C Hamano
Message 29 of 83 in “mingw, windows, crlf/lf, and git”
  1. Mark LevedahlFeb 11, 2007
  2. Johannes SchindelinFeb 11, 2007
  3. Jakub NarebskiFeb 12, 2007
  4. Mark LevedahlFeb 12, 2007
  5. Johannes SchindelinFeb 12, 2007
  6. Robin RosenbergFeb 12, 2007
  7. Mark LevedahlFeb 12, 2007
  8. Theodore TsoFeb 12, 2007
  9. David LangFeb 12, 2007
  10. Johannes SchindelinFeb 12, 2007
  11. Linus TorvaldsFeb 12, 2007
  12. Johannes SchindelinFeb 12, 2007
  13. Linus TorvaldsFeb 12, 2007
  14. Junio C HamanoFeb 12, 2007
  15. Junio C HamanoFeb 12, 2007
  16. Linus TorvaldsFeb 12, 2007
  17. Linus TorvaldsFeb 12, 2007
  18. David LangFeb 12, 2007
  19. Johannes SchindelinFeb 12, 2007
  20. Junio C HamanoFeb 12, 2007
  21. David LangFeb 12, 2007
  22. Johannes SchindelinFeb 12, 2007
  23. Mark LevedahlFeb 13, 2007
  24. Johannes SchindelinFeb 13, 2007
  25. Shawn O. PearceFeb 13, 2007
  26. David LangFeb 13, 2007
  27. Mark LevedahlFeb 13, 2007
  28. Jeff KingFeb 13, 2007
  29. Mark LevedahlFeb 13, 2007
  30. Junio C HamanoFeb 13, 2007
  31. Mark LevedahlFeb 13, 2007
  32. Junio C HamanoFeb 13, 2007
  33. Alexander LitvinovFeb 13, 2007
  34. Johannes SchindelinFeb 13, 2007
  35. Alexander LitvinovFeb 13, 2007
  36. Johannes SchindelinFeb 13, 2007
  37. Mark LevedahlFeb 13, 2007
  38. Linus TorvaldsFeb 13, 2007
  39. Mark LevedahlFeb 14, 2007
  40. Linus TorvaldsFeb 14, 2007
  41. Robin RosenbergFeb 13, 2007
  42. Mark LevedahlFeb 14, 2007
  43. Linus TorvaldsFeb 13, 2007
  44. Linus TorvaldsFeb 13, 2007
  45. Linus TorvaldsFeb 13, 2007
  46. Junio C HamanoFeb 13, 2007
  47. Linus TorvaldsFeb 13, 2007
  48. Sam RavnborgFeb 13, 2007
  49. Nicolas PitreFeb 13, 2007
  50. David LangFeb 13, 2007
  51. Linus TorvaldsFeb 13, 2007
  52. Sam RavnborgFeb 14, 2007
  53. Linus TorvaldsFeb 14, 2007
  54. Sam RavnborgFeb 14, 2007
  55. Alexander LitvinovFeb 14, 2007
  56. Junio C HamanoFeb 14, 2007
  57. Linus TorvaldsFeb 14, 2007
  58. Johannes SchindelinFeb 14, 2007
  59. Mark LevedahlFeb 14, 2007
  60. Linus TorvaldsFeb 14, 2007
  61. Junio C HamanoFeb 14, 2007
  62. Linus TorvaldsFeb 14, 2007
  63. Junio C HamanoFeb 14, 2007
  64. Linus TorvaldsFeb 14, 2007
  65. Johannes SchindelinFeb 14, 2007
  66. Linus TorvaldsFeb 14, 2007
  67. Mark LevedahlFeb 14, 2007
  68. Robin RosenbergFeb 14, 2007
  69. Linus TorvaldsFeb 14, 2007
  70. Robin RosenbergFeb 14, 2007
  71. Linus TorvaldsFeb 14, 2007
  72. Johannes SchindelinFeb 14, 2007
  73. Alexander LitvinovFeb 14, 2007
  74. Linus TorvaldsFeb 14, 2007
  75. Junio C HamanoFeb 14, 2007
  76. Johannes SixtFeb 14, 2007
  77. Linus TorvaldsFeb 14, 2007
  78. Johannes SchindelinFeb 13, 2007
  79. Nicolas PitreFeb 13, 2007
  80. Johannes SchindelinFeb 13, 2007
  81. Junio C HamanoFeb 13, 2007
  82. Linus TorvaldsFeb 13, 2007
  83. Johannes SchindelinFeb 13, 2007

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.