Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should autocrlf=false when cloning repositories? #1071

Open
simendsjo opened this issue Mar 31, 2023 · 3 comments
Open

Should autocrlf=false when cloning repositories? #1071

simendsjo opened this issue Mar 31, 2023 · 3 comments
Labels

Comments

@simendsjo
Copy link

What's wrong

I found out this when using the sly package on Windows for the first time. It has a multi-line format, which broke because autocrlf=true, which is the recommended default on Windows. But (newer) Windows supports only LF too, and when we're not cloning a repo in order to work with cross OS repos, a better default might be autocrlf=false, i.e. as the repo author intended.

This can be done on the clone command by saying --config autocrlf=false, which sets autocrlf=false in .git/config in the cloned repository.

Directions to reproduce

Clone sly on Windows using autocrlf=true and run M-x sly.

Version information

  • Emacs version: 28.2
  • Operating system: Windows 11
@simendsjo simendsjo added the bug label Mar 31, 2023
@progfolio progfolio changed the title Clone should use autocrlf=false? Should autocrlf=false when cloning repositories? Mar 31, 2023
@progfolio
Copy link
Contributor

a better default might be autocrlf=false, i.e. as the repo author intended.

Could this be solved via a repo-specific .gitattributes file rather than hard coding a setting into the clone command?

@simendsjo
Copy link
Author

Could this be solved via a repo-specific .gitattributes file rather than hard coding a setting into the clone command?

.gitattributes overrides user, system and global settings? Maybe a better solution then. Hard to tell 🤷 I really hate autocrlf, but it's a necessary evil on Windows unfortunately. Been years since I tried autocrlf=false on Windows, so maybe I should try again.

I see the following threads have advocates for both sides: https://stackoverflow.com/questions/2825428/why-should-i-use-core-autocrlf-true-in-git#2825829

Why oh why does Windows have to work so different from all other operating systems..? :(

@raxod502
Copy link
Member

raxod502 commented Apr 6, 2023

So currently we don't set any special autocrlf settings in straight.el, because the idea is that probably you want the same settings to be used for straight.el as when you are otherwise cloning repos. Don't you run into similar issues elsewhere on your system if the autocrlf setting is not applied properly?

Generally speaking, I think if git clone fails due to configuration, it is out of scope for straight.el to try and patch the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants