{"thread":{"id":"36961","subject":"The different EOL behavior between libgit2-based software and official Git","startedAt":"2014-06-19T02:59:38Z","lastAt":"2014-06-23T17:29:10Z","messageCount":10,"participants":["Yue Lin Ho","Torsten Bögershausen","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"244616","messageId":"1403146778624-7613670.post@n2.nabble.com","threadId":"36961","inReplyTo":null,"subject":"The different EOL behavior between libgit2-based software and official Git","fromName":"Yue Lin Ho","fromEmail":"yuelinho777@gmail.com","sentAt":"2014-06-19T02:59:38Z","receivedAt":"2014-06-19T02:59:38Z","isPatch":false,"sender":{"key":"yuelinho777@gmail.com","avatar":"https://gravatar.com/avatar/dbf9652003664c7518c86149f9e24df4d178c52526eaffab6f3c3d15b61671e2?d=mp&s=160"},"body":"Hi:\n\n^_^\n\nI did some test on the EOL behavior between official git and libgit2-based\nsoftware(TortoiseGit).\nThen, I got that they have different EOL behavior.\n\nThe blob stored in repository is a text file with mixed EOLs.\nEven set core.autocrlf = true, official git checkout the file as it is(means\nstill *mixed EOLs* there).\nBut, libgit2 checkout it with *All CRLF EOLs*.\n\n * The steps:\n   * set core.autocrlf = false\n   * add file with mixed EOLs\n   * set core.autocrlf = true\n   * delete that file in the working tree\n   * checkout that file\n   * examine the EOL\n\nIf you are interested in this, you might take a look at my testing\nrepository on GitHub.\n(https://github.com/YueLinHo/TestAutoCrlf)\n\nThank you.\n\nYue Lin Ho\n\n\n\n--\nView this message in context: http://git.661346.n2.nabble.com/The-different-EOL-behavior-between-libgit2-based-software-and-official-Git-tp7613670.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"244626","messageId":"53A285A1.3090804@web.de","threadId":"36961","inReplyTo":"1403146778624-7613670.post@n2.nabble.com","subject":"Re: The different EOL behavior between libgit2-based software and official Git","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2014-06-19T06:39:29Z","receivedAt":"2014-06-19T06:39:29Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 06/19/2014 04:59 AM, Yue Lin Ho wrote:\n> Hi:\n>\n> ^_^\n>\n> I did some test on the EOL behavior between official git and libgit2-based\n> software(TortoiseGit).\n> Then, I got that they have different EOL behavior.\n>\n> The blob stored in repository is a text file with mixed EOLs.\n> Even set core.autocrlf = true, official git checkout the file as it is(means\n> still *mixed EOLs* there).\n> But, libgit2 checkout it with *All CRLF EOLs*.\n>\n>   * The steps:\n>     * set core.autocrlf = false\n>     * add file with mixed EOLs\n>     * set core.autocrlf = true\n>     * delete that file in the working tree\n>     * checkout that file\n>     * examine the EOL\n>\n> If you are interested in this, you might take a look at my testing\n> repository on GitHub.\n> (https://github.com/YueLinHo/TestAutoCrlf)\n>\n> Thank you.\n>\n> Yue Lin Ho\n\n(I send a similar mail to msysgit, I'm not sure if this came trough)\n\nSorry being late, I don't think there is something wrong with Git.\nThe core.autocrlf is the \"old\" crlf handling, which has been in Git for \na long time.\n\nIf you exactly know what you are doing, know exactly\nwhich tools are doing what, convince everybody who pulls or pushes to \nthat repo to use\nthe same local config then it may be useful.\n\nIn short: I would strongly recommend to use gitattributes, please see \nbelow.\n\n\ntb@msygit ~/temp\n$ git clone https://github.com/YueLinHo/TestAutoCrlf.git\nCloning into 'TestAutoCrlf'...\n[snip]\n$ cd TestAutoCrlf/\n\ntb@msygit ~/temp/TestAutoCrlf (master)\n$ ls\nCRLF.txt  LF.txt  MIX-more_CRLF.txt  MIX-more_LF.txt  Readme.md\n###### Check how the file looks like:\n$ od -c MIX-more_LF.txt\n0000000   L   i   n   e       1  \\n   l   i   n   e       (   2   ) \\r\n0000020  \\n   l   i   n   e       3   .  \\n   t   h   i   s i   s\n0000040       l   i   n   e       4  \\n   l       i       n       e\n0000060   N   o   .       5  \\n   L   i   n   e       N   u   m b e\n0000100   r       6  \\n\n0000104\n####### The file has one CRLF, the rest is LF, exactly how it had been\n####### commited. So this is what we expect. Or do I miss something ?\n\n\n\n####### Tell Git that MIX-more_LF.txt is a text file:\n$ echo MIX-more_LF.txt text >.gitattributes\n\n####### Verify that MIX-more_LF.txt is text, all other files\n####### are \"binary\" (or \"-text\" in Git language)\n$ git check-attr text *\nCRLF.txt: text: unspecified\nLF.txt: text: unspecified\nMIX-more_CRLF.txt: text: unspecified\nMIX-more_LF.txt: text: set\nReadme.md: text: unspecified\n\n####### Now ask Git to normalize the line endings in the working tree\n$ rm  MIX-more_LF.txt\n\ntb@msygit ~/temp/TestAutoCrlf (master)\n$ git checkout   MIX-more_LF.txt\n\n########## Check what we got:\ntb@msygit ~/temp/TestAutoCrlf (master)\n$ od -c MIX-more_LF.txt\n0000000   L   i   n   e       1  \\r  \\n   l   i   n   e       ( 2 )\n0000020  \\r  \\n   l   i   n   e       3   .  \\r  \\n   t   h   i   s\n0000040   i   s       l   i   n   e       4  \\r  \\n   l i       n\n0000060       e       N   o   .       5  \\r  \\n   L   i   n e N\n0000100   u   m   b   e   r       6  \\r  \\n\n0000111\n######### (This is under Windows, under Linux I would expect only LF)\n######### See core.eol for for information\n\n##########\n########## Now we need to normalize the file in the repo,\n########## All line endings should be LF, otherwise Git\n########## things the file is modified:\n$ git status\nOn branch master\nYour branch is up-to-date with 'origin/master'.\n\nChanges not staged for commit:\n   (use \"git add <file>...\" to update what will be committed)\n   (use \"git checkout -- <file>...\" to discard changes in working \ndirectory)\n\n         modified:   MIX-more_LF.txt\n\nUntracked files:\n   (use \"git add <file>...\" to include in what will be committed)\n\n         .gitattributes\n\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\n\n###############\n############### Do the normalization:\ntb@msygit ~/temp/TestAutoCrlf (master)\n$ git add MIX-more_LF.txt .gitattributes\n\ntb@msygit ~/temp/TestAutoCrlf (master)\n$ git commit -m  \"MIX-more_LF.txt is text\"\n[master 200d874] MIX-more_LF.txt is text\n  Committer: unknown <tb@msysgit>\nYour name and email address were configured automatically based\non your username and hostname. Please check that they are accurate.\nYou can suppress this message by setting them explicitly:\n\n     git config --global user.name \"Your Name\"\n     git config --global user.email you@example.com\n\nAfter doing this, you may fix the identity used for this commit with:\n\n     git commit --amend --reset-author\n\n  2 files changed, 2 insertions(+), 1 deletion(-)\n  create mode 100644 .gitattributes\n\ntb@msygit ~/temp/TestAutoCrlf (master)\n$\n\n######## From now on, MIX-more_LF.txt is treated as text by Git,\n######## and get CRLF under Windows.\n######## I think there is nothing wrong with Git here.\n######## If libgit2 does something different, we need to ask\n######## the libgit2 project, which is independent from Git\n"},{"id":"244627","messageId":"1403162706649-7613681.post@n2.nabble.com","threadId":"36961","inReplyTo":"53A285A1.3090804@web.de","subject":"Re: The different EOL behavior between libgit2-based software and official Git","fromName":"Yue Lin Ho","fromEmail":"yuelinho777@gmail.com","sentAt":"2014-06-19T07:25:06Z","receivedAt":"2014-06-19T07:25:06Z","isPatch":false,"sender":{"key":"yuelinho777@gmail.com","avatar":"https://gravatar.com/avatar/dbf9652003664c7518c86149f9e24df4d178c52526eaffab6f3c3d15b61671e2?d=mp&s=160"},"body":"Hi Torsten Bögershausen:\n\nSince you mail to msysGit first, I reply there.\n(https://groups.google.com/forum/#!topic/msysgit/EDD3RipNeBQ)\n\nThank you again. ^_^\n\nYue Lin Ho\n\n\n\n--\nView this message in context: http://git.661346.n2.nabble.com/The-different-EOL-behavior-between-libgit2-based-software-and-official-Git-tp7613670p7613681.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"244745","messageId":"53A3DB01.7090904@web.de","threadId":"36961","inReplyTo":"53A285A1.3090804@web.de","subject":"Re: The different EOL behavior between libgit2-based software and official Git","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2014-06-20T06:56:01Z","receivedAt":"2014-06-20T06:56:01Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"Hm,\nI feeled puzzled here.\nEven if I wouldn't recommend to use core.autocrlf, and prefer to use .gitattributes,\nthe CRLF conversion should work under Git, but it doensn't seem to do so.\n\nClone this repo:\norigin  https://github.com/YueLinHo/TestAutoCrlf.git\nTry to see if LF or CRLF can be converted into CRLF,\nwhen core.autocrlf is true.\n\n\nNeither msysgit nor Git under Linux produces CRLF (?)\n\nGit under Mac OS produces the CRLF:\nboth Git 2.0.0  and the latest msygit code base (7e872d24a9bd03),\ncompiled under Mac OS\n\nWhat do I miss ?\n\ngit --version\ngit version 2.0.0\ntb@Linux:~/EOL_Test/TestAutoCrlf$ t=MIX-more_LF.txt  &&  rm -f $t &&  git -c core.eol=CRLF checkout $t  && od -c  $t\n0000000   L   i   n   e       1  \\n   l   i   n   e       (   2   )  \\r\n0000020  \\n   l   i   n   e       3   .  \\n   t   h   i   s       i   s\n0000040       l   i   n   e       4  \\n   l       i       n       e    \n0000060   N   o   .       5  \\n   L   i   n   e       N   u   m   b   e\n0000100   r       6  \\n\n\n=============================================\n$ git --version\ngit version 1.9.2.msysgit.0.1206.g7e872d2\n\ntb@msgit ~/EOL_test/TestAutoCrlf (master)\n$  t=MIX-more_LF.txt  &&  rm -f $t &&  git -c core.eol=CRLF checkout $t  && od -c  $t\n0000000   L   i   n   e       1  \\n   l   i   n   e       (   2   )  \\r\n0000020  \\n   l   i   n   e       3   .  \\n   t   h   i   s       i   s\n0000040       l   i   n   e       4  \\n   l       i       n       e\n0000060   N   o   .       5  \\n   L   i   n   e       N   u   m   b   e\n0000100   r       6  \\n\n\n=============================================\ntb@mac:~/EOL_Test/TestAutoCrlf> git --version\ngit version 2.0.0.622.g9478935\ntb@mac:~/EOL_Test/TestAutoCrlf> t=MIX-more_LF.txt  &&  rm -f $t &&  git -c core.eol=CRLF checkout $t  && od -c  $t\n0000000    L   i   n   e       1  \\r  \\n   l   i   n   e       (   2   )\n0000020   \\r  \\n   l   i   n   e       3   .  \\r  \\n   t   h   i   s    \n0000040    i   s       l   i   n   e       4  \\r  \\n   l       i       n\n0000060        e       N   o   .       5  \\r  \\n   L   i   n   e       N\n0000100    u   m   b   e   r       6  \\r  \\n                            \n\n==============================================\ntb@mac:~/EOL_Test/TestAutoCrlf> t=MIX-more_LF.txt  &&  rm -f $t &&  ~/projects/git/tb.msygit/git -c core.eol=CRLF checkout $t  && od -c  $t\n0000000    L   i   n   e       1  \\r  \\n   l   i   n   e       (   2   )\n0000020   \\r  \\n   l   i   n   e       3   .  \\r  \\n   t   h   i   s    \n0000040    i   s       l   i   n   e       4  \\r  \\n   l       i       n\n0000060        e       N   o   .       5  \\r  \\n   L   i   n   e       N\n0000100    u   m   b   e   r       6  \\r  \\n                            \n"},{"id":"244747","messageId":"CAO_ghTLq-a3dJGXvmspaCYS19RhTJzT0teWO5XSfVSiRUN7rrQ@mail.gmail.com","threadId":"36961","inReplyTo":"53A3DB01.7090904@web.de","subject":"Re: The different EOL behavior between libgit2-based software and official Git","fromName":"Yue Lin Ho","fromEmail":"yuelinho777@gmail.com","sentAt":"2014-06-20T08:30:52Z","receivedAt":"2014-06-20T08:30:52Z","isPatch":false,"sender":{"key":"yuelinho777@gmail.com","avatar":"https://gravatar.com/avatar/dbf9652003664c7518c86149f9e24df4d178c52526eaffab6f3c3d15b61671e2?d=mp&s=160"},"body":"Hi:\n\n\n2014-06-20 14:56 GMT+08:00 Torsten Bögershausen <tboegi@web.de>:\n\n> Hm,\n> I feeled puzzled here.\n> Even if I wouldn't recommend to use core.autocrlf, and prefer to use\n> .gitattributes,\n> the CRLF conversion should work under Git, but it doensn't seem to do so.\n>\n> Clone this repo:\n> origin  https://github.com/YueLinHo/TestAutoCrlf.git\n> Try to see if LF or CRLF can be converted into CRLF,\n> when core.autocrlf is true.\n>\n>\n> Neither msysgit nor Git under Linux produces CRLF (?)\n>\n> Git under Mac OS produces the CRLF:\n> both Git 2.0.0  and the latest msygit code base (7e872d24a9bd03),\n> compiled under Mac OS\n>\n> What do I miss ?\n>\n> git --version\n> git version 2.0.0\n> tb@Linux:~/EOL_Test/TestAutoCrlf$ t=MIX-more_LF.txt  &&  rm -f $t &&  git\n> -c core.eol=CRLF checkout $t  && od -c  $t\n> 0000000   L   i   n   e       1  \\n   l   i   n   e       (   2   )  \\r\n> 0000020  \\n   l   i   n   e       3   .  \\n   t   h   i   s       i   s\n> 0000040       l   i   n   e       4  \\n   l       i       n       e\n> 0000060   N   o   .       5  \\n   L   i   n   e       N   u   m   b   e\n> 0000100   r       6  \\n\n>\n> =============================================\n> $ git --version\n> git version 1.9.2.msysgit.0.1206.g7e872d2\n>\n> tb@msgit ~/EOL_test/TestAutoCrlf (master)\n> $  t=MIX-more_LF.txt  &&  rm -f $t &&  git -c core.eol=CRLF checkout $t\n>  && od -c  $t\n> 0000000   L   i   n   e       1  \\n   l   i   n   e       (   2   )  \\r\n> 0000020  \\n   l   i   n   e       3   .  \\n   t   h   i   s       i   s\n> 0000040       l   i   n   e       4  \\n   l       i       n       e\n> 0000060   N   o   .       5  \\n   L   i   n   e       N   u   m   b   e\n> 0000100   r       6  \\n\n>\n> =============================================\n> tb@mac:~/EOL_Test/TestAutoCrlf> git --version\n> git version 2.0.0.622.g9478935\n> tb@mac:~/EOL_Test/TestAutoCrlf> t=MIX-more_LF.txt  &&  rm -f $t &&  git\n> -c core.eol=CRLF checkout $t  && od -c  $t\n> 0000000    L   i   n   e       1  \\r  \\n   l   i   n   e       (   2   )\n> 0000020   \\r  \\n   l   i   n   e       3   .  \\r  \\n   t   h   i   s\n> 0000040    i   s       l   i   n   e       4  \\r  \\n   l       i       n\n> 0000060        e       N   o   .       5  \\r  \\n   L   i   n   e       N\n> 0000100    u   m   b   e   r       6  \\r  \\n\n>\n> ==============================================\n> tb@mac:~/EOL_Test/TestAutoCrlf> t=MIX-more_LF.txt  &&  rm -f $t &&\n>  ~/projects/git/tb.msygit/git -c core.eol=CRLF checkout $t  && od -c  $t\n> 0000000    L   i   n   e       1  \\r  \\n   l   i   n   e       (   2   )\n> 0000020   \\r  \\n   l   i   n   e       3   .  \\r  \\n   t   h   i   s\n> 0000040    i   s       l   i   n   e       4  \\r  \\n   l       i       n\n> 0000060        e       N   o   .       5  \\r  \\n   L   i   n   e       N\n> 0000100    u   m   b   e   r       6  \\r  \\n\n>\n>\n>\n>\n​Wow!\n\nP.S.\nlibgit2 just has a PR that try to be identical with official git.\nSee https://github.com/libgit2/libgit2/pull/2432\n\nYue Lin Ho\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/d/optout.\n"},{"id":"244748","messageId":"1403253871592-7613801.post@n2.nabble.com","threadId":"36961","inReplyTo":"53A3DB01.7090904@web.de","subject":"Re: The different EOL behavior between libgit2-based software and official Git","fromName":"Yue Lin Ho","fromEmail":"yuelinho777@gmail.com","sentAt":"2014-06-20T08:44:31Z","receivedAt":"2014-06-20T08:44:31Z","isPatch":false,"sender":{"key":"yuelinho777@gmail.com","avatar":"https://gravatar.com/avatar/dbf9652003664c7518c86149f9e24df4d178c52526eaffab6f3c3d15b61671e2?d=mp&s=160"},"body":"Wow!\n\nP.S.\nA note:\nlibgit2 just has a PR that try to be identical with official git 2.0.0.\nSee https://github.com/libgit2/libgit2/pull/2432\n\n\n\n--\nView this message in context: http://git.661346.n2.nabble.com/The-different-EOL-behavior-between-libgit2-based-software-and-official-Git-tp7613670p7613801.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"244752","messageId":"53A40DEC.4050902@web.de","threadId":"36961","inReplyTo":"CAO_ghTLq-a3dJGXvmspaCYS19RhTJzT0teWO5XSfVSiRUN7rrQ@mail.gmail.com","subject":"Re: [msysGit] Re: The different EOL behavior between libgit2-based software and official Git","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2014-06-20T10:33:16Z","receivedAt":"2014-06-20T10:33:16Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"\n> ​Wow!\n> \n> P.S.\n> libgit2 just has a PR that try to be identical with official git.\n> See https://github.com/libgit2/libgit2/pull/2432\n> \n> Yue Lin Ho \n> \n\nI am not sure how much problems Git/libgit2 have with files contains mixed LF-CRLF,\nas I have the same problem with the LF.txt\n\nThe handling, according to my understandig, is:\nWhen core.eol is CRLF (or native under Windows) and core.autocrlf is true, and a file\nis checked out:\n  If a file has CRLF in one line in the repo, nothing is changed.\n  If a file has LF in one line in the repo, LF is converted into CRLF in the workspace.\n\nBut here at my systems this doesn't seem to work as expected either for LF.txt:\n\ntb@mac:~/EOL_Test/TestAutoCrlf>  t=LF.txt  &&  rm -f $t &&  git -c core.eol=CRLF checkout $t  && od -c  $t\n0000000    L   i   n   e       1  \\r  \\n   l   i   n   e       (   2   )\n0000020   \\r  \\n   l   i   n   e       3   .  \\r  \\n   t   h   i   s    \n0000040    i   s       l   i   n   e       4  \\r  \\n   l       i       n\n0000060        e       N   o   .       5  \\r  \\n   L   i   n   e       N\n0000100    u   m   b   e   r       6  \\r  \\n  \\r  \\n                    \n==================\ntb@Linux:~/EOL_Test/TestAutoCrlf$ t=LF.txt  &&  rm -f $t &&  git -c core.eol=CRLF checkout $t  && od -c  $t\n0000000   L   i   n   e       1  \\n   l   i   n   e       (   2   )  \\n\n0000020   l   i   n   e       3   .  \\n   t   h   i   s       i   s    \n0000040   l   i   n   e       4  \\n   l       i       n       e       N\n0000060   o   .       5  \\n   L   i   n   e       N   u   m   b   e   r\n0000100       6  \\n  \\n\n"},{"id":"244804","messageId":"xmqqmwd7ee2j.fsf@gitster.dls.corp.google.com","threadId":"36961","inReplyTo":"53A40DEC.4050902@web.de","subject":"Re: Re: The different EOL behavior between libgit2-based software and official Git","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-06-20T16:33:08Z","receivedAt":"2014-06-20T16:33:08Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Torsten Bögershausen <tboegi@web.de> writes:\n\ntb@Linux:~/EOL_Test/TestAutoCrlf$ t=LF.txt  &&  rm -f $t &&  git -c core.eol=CRLF checkout $t  && od -c  $t\n0000000   L   i   n   e       1  \\n   l   i   n   e       (   2   )  \\n\n0000020   l   i   n   e       3   .  \\n   t   h   i   s       i   s    \n0000040   l   i   n   e       4  \\n   l       i       n       e       N\n0000060   o   .       5  \\n   L   i   n   e       N   u   m   b   e   r\n0000100       6  \\n  \\n\n\nIn Documentation/config.txt, we find:\n\n    core.eol::\n            Sets the line ending type to use in the working directory for\n            files that have the `text` property set.  Alternatives are ...\n\nDoes that file $t in your practice \"have the `text` property set\"?\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/d/optout.\n"},{"id":"244833","messageId":"53A67BE1.4060903@web.de","threadId":"36961","inReplyTo":"xmqqmwd7ee2j.fsf@gitster.dls.corp.google.com","subject":"Re: [msysGit] Re: The different EOL behavior between libgit2-based software and official Git","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2014-06-22T06:46:57Z","receivedAt":"2014-06-22T06:46:57Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 2014-06-20 18.33, Junio C Hamano wrote:\n> Torsten Bögershausen <tboegi@web.de> writes:\n> \n> tb@Linux:~/EOL_Test/TestAutoCrlf$ t=LF.txt  &&  rm -f $t &&  git -c core.eol=CRLF checkout $t  && od -c  $t\n> 0000000   L   i   n   e       1  \\n   l   i   n   e       (   2   )  \\n\n> 0000020   l   i   n   e       3   .  \\n   t   h   i   s       i   s    \n> 0000040   l   i   n   e       4  \\n   l       i       n       e       N\n> 0000060   o   .       5  \\n   L   i   n   e       N   u   m   b   e   r\n> 0000100       6  \\n  \\n\n> \n> In Documentation/config.txt, we find:\n> \n>     core.eol::\n>             Sets the line ending type to use in the working directory for\n>             files that have the `text` property set.  Alternatives are ...\n> \n> Does that file $t in your practice \"have the `text` property set\"?\n> \nNo, it hadn't, under my Linux box.\n(And I had a .gittatributes file on the Mac OS box, which I forgot about.\nI am really sorry for the confusion and saying that Git behaves different under Linux and Mac OS).\n\nYou are pointing into the right direction:\nFiles with mixed LF CRLF in the repo are not changed by Git, when the checkout out\nor checked in, unless the .gitattributes say that the file is text.\n\nAnd libgit2 should do the same.\n\n\nHowever, I was confused by this\nhttps://www.kernel.org/pub/software/scm/git/docs/git-config.html\n(My comments inline with ##)\n-----------------------\ncore.autocrlf\n\n    Setting this variable to \"true\" is almost the same as setting the text attribute to \"auto\" on all files except that text files are not guaranteed to be normalized: files that contain CRLF in the repository will not be touched. \n## And is this line still valid:\nUse this setting if you want to have CRLF line endings in your working directory even though the repository does not have normalized line endings. \n\n## In 2010 the \"the new safer autocrlf handling\" was introduced,\n## and it looks as if commits fd6cce9e and c4805393 are involved here.\n## When the file in the repo has only LF, it will have CRLF in the work tree\n## When the file in the repo has mixed LF and CRLF, it will not be changed in the work tree\n## and will have mixed line endings in the work tree\n## When the file in the repo has only CRLF, it will not be changed in the work tree\n## and will have CRLF in the work tree as well as in the repo.\n\n##Should this line simply be dropped in the documentation ?\n"},{"id":"244883","messageId":"xmqqionrcz6h.fsf@gitster.dls.corp.google.com","threadId":"36961","inReplyTo":"53A67BE1.4060903@web.de","subject":"Re: Re: The different EOL behavior between libgit2-based software and official Git","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-06-23T17:29:10Z","receivedAt":"2014-06-23T17:29:10Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Torsten Bögershausen <tboegi@web.de> writes:\n\n> No, it hadn't, under my Linux box.\n> (And I had a .gittatributes file on the Mac OS box, which I forgot about.\n\nOK, that explains the difference; thanks for double-checking.\n\n> Files with mixed LF CRLF in the repo are not changed by Git, when the checkout out\n> or checked in, unless the .gitattributes say that the file is text.\n\nHmph, I would have thought, after reading the \"Does anybody do that\ncrazy stuff\" comment in convert.c, that we refrain from attempting\nto convert a file with a mixed mess, even if the file is marked as\ntext, because it is unclear what it means to have both LF and CRLF\nin a file that is text.  Is \"A\\rB\\nC\\r\\n\" a line terminated with a\nCRLF that happens to have a lone CR and then LF in between?\n\nYou may be looking at a bug in a corner case that is so irrelevant\nthat nobody has even noticed, let alone attempted to fix.\n\n-- \n-- \n*** Please reply-to-all at all times ***\n*** (do not pretend to know who is subscribed and who is not) ***\n*** Please avoid top-posting. ***\nThe msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.\n\nYou received this message because you are subscribed to the Google\nGroups \"msysGit\" group.\nTo post to this group, send email to msysgit@googlegroups.com\nTo unsubscribe from this group, send email to\nmsysgit+unsubscribe@googlegroups.com\nFor more options, and view previous threads, visit this group at\nhttp://groups.google.com/group/msysgit?hl=en_US?hl=en\n\n--- \nYou received this message because you are subscribed to the Google Groups \"msysGit\" group.\nTo unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.\nFor more options, visit https://groups.google.com/d/optout.\n"}]}