devstream-io / devstream

DevStream: the open-source DevOps toolchain manager (DTM).
https://www.devstream.io
Apache License 2.0
858 stars 193 forks source link

:four_leaf_clover: `Proposal`: Maybe We Need `.gitattributes` #541

Closed iyear closed 2 years ago

iyear commented 2 years ago

What would you like to add? Why is this needed?

533

I'm using windows and after running make fmt in wsl all the CRLFs are replaced with LFs, resulting in all the files becoming changed.

Do we need a .gitattributes to unify the different platforms?

shubham-cmyk commented 2 years ago

Are you able to buid in WSL ? few days back I was also on WSL but the make build was showing some errors

iyear commented 2 years ago

@shubham-cmyk I haven't use make build, I just found this after using make fmt

daniel-hutao commented 2 years ago

@iyear are you execute the make fmt in Windows Subsystem for Linux? I only have an arm64 mac and can't reproduce this problem. But it sounds a good idea to add a .gitattributes

@IronCore864 What's your opinion?

iyear commented 2 years ago

@daniel-hutao Yes, I run make fmt in WSL

algobot76 commented 2 years ago

Related issue: https://github.com/golang/go/issues/16355

algobot76 commented 2 years ago

Maybe this helps?

image

https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration

iyear commented 2 years ago

@algobot76 Yes, it solves the problem, but it requires every windows contributor to set this config on every machine. So the .gitattributes addition is still necessary.

daniel-hutao commented 2 years ago

@algobot76 Yes, it solves the problem, but it requires every windows contributor to set this config on every machine. So the .gitattributes addition is still necessary.

@algobot76 Thank you for the reply!

@iyear I agree with you. Although we should set the core.autocrlf locally, but maybe some users won't know what happened and what can do to fix it. So the .gitattributes will be a friendly configuration.

Would you please adding this config file and do some tests with it?

iyear commented 2 years ago

@daniel-hutao I know roughly how .gitattributes should be written, but what does it mean to test? Like if I run make fmt once to see if it makes all files changed?

Or need a specific test file? I don't seem to know what this is.

algobot76 commented 2 years ago

@daniel-hutao I know roughly how .gitattributes should be written, but what does it mean to test? Like if I run make fmt once to see if it makes all files changed?

Or need a specific test file? I don't seem to know what this is.

I guess you could use a simple bash script to test if the line ending is what you expected after running make fmt. See https://stackoverflow.com/a/3570161

iyear commented 2 years ago

@daniel-hutao I know roughly how .gitattributes should be written, but what does it mean to test? Like if I run make fmt once to see if it makes all files changed? Or need a specific test file? I don't seem to know what this is.

I guess you could use a simple bash script to test if the line ending is what you expected after running make fmt. See https://stackoverflow.com/a/3570161

I may know what to do now, thanks for the reply!