{"thread":{"id":"44064","subject":"Gitattributes file is not respected when switching between branches","startedAt":"2016-09-12T12:55:47Z","lastAt":"2016-09-18T19:32:02Z","messageCount":5,"participants":["Виталий Ищенко","Torsten Bögershausen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"301720","messageId":"CANYoZJng0GNZWU=eUEnXgVQ_NKQQOKM+mhJ9bsXMEJxxEhwQMw@mail.gmail.com","threadId":"44064","inReplyTo":null,"subject":"Gitattributes file is not respected when switching between branches","fromName":"Виталий Ищенко","fromEmail":"betalb@gmail.com","sentAt":"2016-09-12T12:55:31Z","receivedAt":"2016-09-12T12:55:47Z","isPatch":false,"sender":{"key":"betalb@gmail.com","avatar":null},"body":"Good day\n\nI faced following issue with gitattributes file (at least eol setting)\nwhen was trying to force `lf` mode on windows.\n\nWe have 2 branches: master & dev. With master set as HEAD in repository\n\nI've added `.gitattributes` with following content to `dev` branch\n\n```\n* text eol=lf\n```\n\nNow when you clone this repo on other machine and checkout dev branch,\neol setting is not respected.\nAs a workaround you can rm all files except .git folder and do hard reset.\n\nIssue is reproducible on windows & unix versions. Test repo can be\nfound on github\nhttps://github.com/betalb/gitattributes-issue\n\nmaster branch - one file without gitattributes\nfeature-branch - .gitattributes added with eol=lf\nunix-feature-branch - .gitattributes added with eol=crlf\n\nThanks,\nVitalii\n"},{"id":"301747","messageId":"8df2883f-ec3c-3446-2e06-207c93452332@web.de","threadId":"44064","inReplyTo":"CANYoZJng0GNZWU=eUEnXgVQ_NKQQOKM+mhJ9bsXMEJxxEhwQMw@mail.gmail.com","subject":"Re: Gitattributes file is not respected when switching between branches","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2016-09-12T19:35:10Z","receivedAt":"2016-09-12T19:35:28Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 12.09.16 14:55, Виталий Ищенко wrote:\n> Good day\n>\n> I faced following issue with gitattributes file (at least eol setting)\n> when was trying to force `lf` mode on windows.\n>\n> We have 2 branches: master & dev. With master set as HEAD in repository\n>\n> I've added `.gitattributes` with following content to `dev` branch\n>\n> ```\n> * text eol=lf\n> ```\n>\n> Now when you clone this repo on other machine and checkout dev branch,\n> eol setting is not respected.\n> As a workaround you can rm all files except .git folder and do hard reset.\n>\n> Issue is reproducible on windows & unix versions. Test repo can be\n> found on github\n> https://github.com/betalb/gitattributes-issue\n>\n> master branch - one file without gitattributes\n> feature-branch - .gitattributes added with eol=lf\n> unix-feature-branch - .gitattributes added with eol=crlf\n>\n> Thanks,\n> Vitalii\nSome more information may be needed, to help to debug.\n\nWhich version of Git are you using ?\nWhat does\n\ngit ls-files --eol\n\nsay ?\n\n\n"},{"id":"301749","messageId":"7c14756e-29f9-b475-f5f5-597acb8cea98@web.de","threadId":"44064","inReplyTo":"8df2883f-ec3c-3446-2e06-207c93452332@web.de","subject":"Re: Gitattributes file is not respected when switching between branches","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2016-09-12T19:42:08Z","receivedAt":"2016-09-12T19:42:18Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 12.09.16 21:35, Torsten Bögershausen wrote:\n> On 12.09.16 14:55, Виталий Ищенко wrote:\n>> Good day\n>>\n>> I faced following issue with gitattributes file (at least eol setting)\n>> when was trying to force `lf` mode on windows.\n>>\n>> We have 2 branches: master & dev. With master set as HEAD in repository\n>>\n>> I've added `.gitattributes` with following content to `dev` branch\n>>\n>> ```\n>> * text eol=lf\n>> ```\n>>\n>> Now when you clone this repo on other machine and checkout dev branch,\n>> eol setting is not respected.\n>> As a workaround you can rm all files except .git folder and do hard reset.\n>>\n>> Issue is reproducible on windows & unix versions. Test repo can be\n>> found on github\n>> https://github.com/betalb/gitattributes-issue\n>>\n>> master branch - one file without gitattributes\n>> feature-branch - .gitattributes added with eol=lf\n>> unix-feature-branch - .gitattributes added with eol=crlf\n>>\n>> Thanks,\n>> Vitalii\n> Some more information may be needed, to help to debug.\n>\n> Which version of Git are you using ?\n> What does\n>\n> git ls-files --eol\n>\n> say ?\nObs, All information was in the email.\n\ntb@xxx:/tmp/gitattributes-issue> git ls-files --eol\ni/lf    w/lf    attr/                   testfile-crlf.txt\ntb@xxx:/tmp/gitattributes-issue> ls -al\ntotal 8\ndrwxr-xr-x   4 tb    wheel  136 Sep 12 21:38 .\ndrwxrwxrwt  19 root  wheel  646 Sep 12 21:38 ..\ndrwxr-xr-x  13 tb    wheel  442 Sep 12 21:38 .git\n-rw-r--r--   1 tb    wheel   60 Sep 12 21:38 testfile-crlf.txt\ntb@xxx:/tmp/gitattributes-issue>\n\nCould it be that you didn't commit the file \".gitattributes\" ?\nThis could help:\ngit add .gitattributes && git commit -m \"Add .gitattributes\"\n\n\n\n\n\n\n\n"},{"id":"302046","messageId":"CANYoZJnB81rEGNAjGj6jOscmdSW_niSy6jRP6acw2xB4ssX8xA@mail.gmail.com","threadId":"44064","inReplyTo":"7c14756e-29f9-b475-f5f5-597acb8cea98@web.de","subject":"Re: Gitattributes file is not respected when switching between branches","fromName":"Виталий Ищенко","fromEmail":"betalb@gmail.com","sentAt":"2016-09-16T06:51:30Z","receivedAt":"2016-09-16T06:51:39Z","isPatch":false,"sender":{"key":"betalb@gmail.com","avatar":null},"body":"Sorry for delay.\n\n\".gitattributes\" indeed is not present in \"master\", but this is intentionally\nIt is placed only in following 2 branches:\nfeature-branch\nunix-feature-branch\n\nThis is how flow looks on windows\n$ git --version\ngit version 2.9.3.windows.1\n\nvitalii.ishchenko@DESKTOP-9TC9UPB MINGW64 /c/work/repos/gitattributes (master)\n$ git ls-files --eol\ni/lf    w/crlf  attr/                   testfile-crlf.txt\n\nvitalii.ishchenko@DESKTOP-9TC9UPB MINGW64 /c/work/repos/gitattributes (master)\n$ git checkout feature-branch\nSwitched to branch 'feature-branch'\nYour branch is up-to-date with 'origin/feature-branch'.\n\nvitalii.ishchenko@DESKTOP-9TC9UPB MINGW64 /c/work/repos/gitattributes\n(feature-branch)\n$ git ls-files --eol\ni/lf    w/lf    attr/text eol=lf        .gitattributes\ni/lf    w/crlf  attr/text eol=lf        testfile-crlf.txt\n\n\n\nOn Mon, Sep 12, 2016 at 10:42 PM, Torsten Bögershausen <tboegi@web.de> wrote:\n> On 12.09.16 21:35, Torsten Bögershausen wrote:\n>> On 12.09.16 14:55, Виталий Ищенко wrote:\n>>> Good day\n>>>\n>>> I faced following issue with gitattributes file (at least eol setting)\n>>> when was trying to force `lf` mode on windows.\n>>>\n>>> We have 2 branches: master & dev. With master set as HEAD in repository\n>>>\n>>> I've added `.gitattributes` with following content to `dev` branch\n>>>\n>>> ```\n>>> * text eol=lf\n>>> ```\n>>>\n>>> Now when you clone this repo on other machine and checkout dev branch,\n>>> eol setting is not respected.\n>>> As a workaround you can rm all files except .git folder and do hard reset.\n>>>\n>>> Issue is reproducible on windows & unix versions. Test repo can be\n>>> found on github\n>>> https://github.com/betalb/gitattributes-issue\n>>>\n>>> master branch - one file without gitattributes\n>>> feature-branch - .gitattributes added with eol=lf\n>>> unix-feature-branch - .gitattributes added with eol=crlf\n>>>\n>>> Thanks,\n>>> Vitalii\n>> Some more information may be needed, to help to debug.\n>>\n>> Which version of Git are you using ?\n>> What does\n>>\n>> git ls-files --eol\n>>\n>> say ?\n> Obs, All information was in the email.\n>\n> tb@xxx:/tmp/gitattributes-issue> git ls-files --eol\n> i/lf    w/lf    attr/                   testfile-crlf.txt\n> tb@xxx:/tmp/gitattributes-issue> ls -al\n> total 8\n> drwxr-xr-x   4 tb    wheel  136 Sep 12 21:38 .\n> drwxrwxrwt  19 root  wheel  646 Sep 12 21:38 ..\n> drwxr-xr-x  13 tb    wheel  442 Sep 12 21:38 .git\n> -rw-r--r--   1 tb    wheel   60 Sep 12 21:38 testfile-crlf.txt\n> tb@xxx:/tmp/gitattributes-issue>\n>\n> Could it be that you didn't commit the file \".gitattributes\" ?\n> This could help:\n> git add .gitattributes && git commit -m \"Add .gitattributes\"\n>\n>\n>\n>\n>\n>\n>\n"},{"id":"302119","messageId":"beaf2e9c-70c9-b80a-b201-aeed830f8807@web.de","threadId":"44064","inReplyTo":"CANYoZJnB81rEGNAjGj6jOscmdSW_niSy6jRP6acw2xB4ssX8xA@mail.gmail.com","subject":"Re: Gitattributes file is not respected when switching between branches","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2016-09-18T19:31:48Z","receivedAt":"2016-09-18T19:32:02Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 16.09.16 08:51, Виталий Ищенко wrote:\n> Sorry for delay.\n> \nNo problem about the delay.\n\n(And please no top-posting)\n\n\nIf you say\n> \".gitattributes\" indeed is not present in \"master\", but this is intentionally\nthen nobody has (to my knowledge) thought about this situation/workflow yet.\n\n\nThe short version:\nGit is designed to have the same .gitattributes in different branches.\nAt least not in the long run.\n\nA typical use case is to create a repo, adjust the\n.gitattributes and keep this in all branches.\n\n\n\n \n\n\n\n"}]}