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

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

From
Theodore Tso <tytso@mit.edu>
Date
Feb 12, 2007, 04:24 UTC
Message-ID
<20070212042425.GB18010@thunk.org>
In-Reply-To
<45CFA30C.6030202@verizon.net>
On Sun, Feb 11, 2007 at 06:13:16PM -0500, Mark Levedahl wrote:
Show 16 quoted lines
> I am NOT intending to start a flamewar O:-) , so please don't turn this 
> into one.
> 
> The recent threads on a mingw git port are explicit in the intent to 
> provide a Windows native git. I believe there is a fundamental conflict 
> here with the position, clearly stated by Linus, that git does not alter 
> content in any way. Windows suffers the curse of DOS line endings (\r\n 
> vs \n), and a true port to Windows *must* allow for \r\n and \n to be 
> semantically the same thing as most large projects end up with a mixture 
> of such files and/or are targeting cross-platform capabilities. The 
> major competing solutions git seeks to supplant (cvs, cvsnt, svn, hg) 
> have capability to recognize "text" files and transparently replace \r\n 
> with \n on input, the reverse on output, and ignore all such differences 
> on diff operations. To be relevant on native Windows, git must do the 
> same. Otherwise, git will be deemed "too wierd" and dismissed in favor 
> of a tool "that works."

So this is something that I've tried proposing to the Mercurial developers, but it's never been implemented in hg. It'll be interesting to see what the git community thinks. :-)

My proposal does require adding a file type to each file, as tracked metadata, which may doom it from the start. If you add a file type, then you have to support mutating the file type, and some way of handling merge conflicts (generally, picking one type or another).

Then for each file type, we implement a set of interfaces (perhaps as simple as a series of executables named git-<type>-<operation>) which if present, transforms the file from its live format to the canonical format which is actually checked in and back again. Besides using this for the DOS CR/LF problem, it also allows for an efficient storage of things like OpenOffice files which are a zipped set of .xml files. By decompressing them before pushing them into the SCM, it means that if the user makes a tiny spelling correction in their OpenOffice file, the delta stored in the git repository can be much more efficiently stored (since the diff of the .xml tree will be small, where as the diff of the entire compressed file is likely going to be close to the entire size of the .odt file).

Another nice thing to provide for each file type would be a pretty-printer for the diffs, so it becomes easier to see the delta between two versions of an OpenOffice file in a textual window.

So, is this idea sane or completely insane? Hopefully it passes Linus's it-solves-multiple-problems-at-once test, at least. :-)

							- Ted
Previous: Mark LevedahlNext: David Lang
Message 8 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.