{"thread":{"id":"60477","subject":"Explanation of `eol` attribute doesn't seem correct for Windows machines","startedAt":"2023-11-06T15:11:57Z","lastAt":"2023-11-07T17:12:20Z","messageCount":4,"participants":["Hans Meiser","Torsten Bögershausen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"484461","messageId":"AS4P195MB15272FE283D0CF606A8B074EE2AAA@AS4P195MB1527.EURP195.PROD.OUTLOOK.COM","threadId":"60477","inReplyTo":null,"subject":"Explanation of `eol` attribute doesn't seem correct for Windows machines","fromName":"Hans Meiser","fromEmail":"brille1@hotmail.com","sentAt":"2023-11-06T15:11:54Z","receivedAt":"2023-11-06T15:11:57Z","isPatch":false,"sender":{"key":"brille1@hotmail.com","avatar":null},"body":"https://git-scm.com/docs/gitattributes#_eol\n\nclaims that:\n\n---\nSet to string value \"crlf\"\n\n    This setting converts the file’s line endings in the working directory to CRLF when the file is checked out.\nSet to string value \"lf\"\n\n    This setting uses the same line endings in the working directory as in the index when the file is checked out.\n---\n\nI don't think this explanation is sufficient for files stored on Windows machines. A file might be stored with CRLF in the index. What happens then? And what happens when a file is added to the index with `core.autocrlf=input` on Windows machines?"},{"id":"484465","messageId":"20231106162125.GA31375@tb-raspi4","threadId":"60477","inReplyTo":"AS4P195MB15272FE283D0CF606A8B074EE2AAA@AS4P195MB1527.EURP195.PROD.OUTLOOK.COM","subject":"Re: Explanation of `eol` attribute doesn't seem correct for Windows machines","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2023-11-06T16:21:25Z","receivedAt":"2023-11-06T16:21:33Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On Mon, Nov 06, 2023 at 03:11:54PM +0000, Hans Meiser wrote:\n> https://git-scm.com/docs/gitattributes#_eol\n>\n> claims that:\n>\n> ---\n> Set to string value \"crlf\"\n>\n>     This setting converts the file’s line endings in the working directory to CRLF when the file is checked out.\n> Set to string value \"lf\"\n>\n>     This setting uses the same line endings in the working directory as in the index when the file is checked out.\n> ---\n>\n> I don't think this explanation is sufficient for files stored on Windows machines.\n> A file might be stored with CRLF in the index.\n> What happens then?\n\n  >This setting uses the same line endings in the working directory\n  >as in the index when the file is checked out.\n  If you have a file commited with CRLF into the index, it will have CRLF in the working tree.\n  If the file had been commited with LF into the index, it will have LF in the working tree.\n  That is what the documentation tries to say, I think.\n\nHowever, the above discussion is only valid, when the \"text\" attribute is defined.\nOtherwise the eol attribute has no effect.\nSo you need something like\n* text=auto\nand/or\n*.txt text\nin your .gitattributes file\n\n\n> And what happens when a file is added to the index with `core.autocrlf=input` on Windows machines?\nDo you have a .gitattributes file ? Or not ?\nIs the file a new one, or does it exist ?\n\nIn any way,\ngit ls-files --eol\nmay help to find out, what is in the index and what is in the workingtree.\n"},{"id":"484484","messageId":"AS4P195MB1527BC2DF67412D4FF340989E2A9A@AS4P195MB1527.EURP195.PROD.OUTLOOK.COM","threadId":"60477","inReplyTo":"20231106162125.GA31375@tb-raspi4","subject":"Re: Explanation of `eol` attribute doesn't seem correct for Windows machines","fromName":"Hans Meiser","fromEmail":"brille1@hotmail.com","sentAt":"2023-11-07T00:23:29Z","receivedAt":"2023-11-07T00:23:33Z","isPatch":false,"sender":{"key":"brille1@hotmail.com","avatar":null},"body":"> > And what happens when a file is added to the index with `core.autocrlf=input` on Windows machines?\n> Do you have a .gitattributes file ? Or not ?\n> Is the file a new one, or does it exist ?\n\nExactly all these questions/cases should be explained by the documentation, I suppose.\n\n-------\nFrom: Torsten Bögershausen <tboegi@web.de>\nSent: Monday, November 6, 2023 17:21\nTo: Hans Meiser <brille1@hotmail.com>\nCc: git@vger.kernel.org <git@vger.kernel.org>\nSubject: Re: Explanation of `eol` attribute doesn't seem correct for Windows machines \n \nOn Mon, Nov 06, 2023 at 03:11:54PM +0000, Hans Meiser wrote:\n> https://git-scm.com/docs/gitattributes#_eol\n>\n> claims that:\n>\n> ---\n> Set to string value \"crlf\"\n>\n>     This setting converts the file’s line endings in the working directory to CRLF when the file is checked out.\n> Set to string value \"lf\"\n>\n>     This setting uses the same line endings in the working directory as in the index when the file is checked out.\n> ---\n>\n> I don't think this explanation is sufficient for files stored on Windows machines.\n> A file might be stored with CRLF in the index.\n> What happens then?\n\n  >This setting uses the same line endings in the working directory\n  >as in the index when the file is checked out.\n  If you have a file commited with CRLF into the index, it will have CRLF in the working tree.\n  If the file had been commited with LF into the index, it will have LF in the working tree.\n  That is what the documentation tries to say, I think.\n\nHowever, the above discussion is only valid, when the \"text\" attribute is defined.\nOtherwise the eol attribute has no effect.\nSo you need something like\n* text=auto\nand/or\n*.txt text\nin your .gitattributes file\n\n\n> And what happens when a file is added to the index with `core.autocrlf=input` on Windows machines?\nDo you have a .gitattributes file ? Or not ?\nIs the file a new one, or does it exist ?\n\nIn any way,\ngit ls-files --eol\nmay help to find out, what is in the index and what is in the workingtree."},{"id":"484531","messageId":"20231107171215.GA28569@tb-raspi4","threadId":"60477","inReplyTo":"AS4P195MB1527BC2DF67412D4FF340989E2A9A@AS4P195MB1527.EURP195.PROD.OUTLOOK.COM","subject":"Re: Explanation of `eol` attribute doesn't seem correct for Windows machines","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2023-11-07T17:12:15Z","receivedAt":"2023-11-07T17:12:20Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On Tue, Nov 07, 2023 at 12:23:29AM +0000, Hans Meiser wrote:\n> > > And what happens when a file is added to the index with `core.autocrlf=input` on Windows machines?\n> > Do you have a .gitattributes file ? Or not ?\n> > Is the file a new one, or does it exist ?\n>\n> Exactly all these questions/cases should be explained by the documentation, I suppose.\n\nIn general, the CRLF - LF (\"line endings\") conversion is defined by\ndifferent settings.\n\nThe .gitattributes file (which is typically added to the repo and commited,\nso that it travels trough into all repos by using `git clone`, `git pull`\nor `git fetch` followed by a `git checkout`\n\nThis link\nhttps://git-scm.com/docs/gitattributes#_text\nshould describe everything you may want to know about\n.gitattributes\nto handle line endings.\nIf I say \"should\" then this is from a perspective of someone who has read and used this\ntoo often to see with fresh eyes what may be missing.\n\n"}]}