Conan-center-index: [service] Use gitattributes to ensure line-endings

Created on 4 Nov 2020  路  4Comments  路  Source: conan-io/conan-center-index

We've got some issues regarding line endings, especially in Windows machines (configured with autocrlf=true). The problem is that if Git modifies the line-endings of recipe files, then Conan will compute a different recipe revision.

This is something that cannot be enforced in Conan, we don't want the Conan client to modify files, but it is something that we can force at this repository level using .gitattributes file. I would say that we can almost enforce EOL for all the files in this repository (maybe there is some binary file in some test_package), or at least force it for .py, .txt, .yml,... extensions.

Please, comment here if you have any concerns about it, or you think it can break something.

Thanks!

Most helpful comment

There are few patches with .cmake extension instead of .diff or .patch, in aws-checksums, easyhttpcpp and libnghttp2 recipes.

All 4 comments

Probably these file extensions should be enough:

*.py text eol=lf
*.yml text eol=lf
*.diff text eol=lf
*.patch text eol=lf
*.conf text eol=lf
*.md text eol=lf
*.txt text eol=lf
*.cmake text eol=lf

Any other file extension that we should consider?

Maybe *.c, *.cpp if we consider test_package, but I think that is not a problem for the recipe revision computation.
Any build system-related files like *.cmake? I am not sure if any recipe is exporting such files....

There are few patches with .cmake extension instead of .diff or .patch, in aws-checksums, easyhttpcpp and libnghttp2 recipes.

I'm really surprised that we don't have one already. For some reason, I was assuming all the time that we have one and wondered why I still have line ending issues when working in parallel with Windows and Linux with the same git clone of CCI 馃槄

For what's worth it, that is the current .gitattributes of Bincrafters https://github.com/bincrafters/templates/blob/main/.gitattributes

Was this page helpful?
0 / 5 - 0 ratings