-
Notifications
You must be signed in to change notification settings - Fork 155
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
Add repo files to help maintain conventions #715
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# EditorConfig is awesome:http://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.sh] | ||
indent_size = 4 | ||
|
||
[*.json] | ||
indent_size = 2 | ||
|
||
[*.css] | ||
indent_size = 2 |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,8 @@ | ||||||||||
############################################################################### | ||||||||||
# Set default behavior to automatically normalize line endings. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
############################################################################### | ||||||||||
* text=auto | ||||||||||
|
||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't agree we should change the default. For reference, what this does is convert files that git detects as text to have CRLF line endings when checked out on Windows. But I've never seen a programming-oriented text editor on Windows in the past two decades that didn't work just fine with LF-only files, preserving their LF-onlyness. The auto-conversion behaviour, on the other hand, is liable to cause things to break in unpredictable ways when building or testing from a checkout that has been converted. If someone wants the conversion behaviour, they can and should set the
Suggested change
From the PR description:
Not in practice; I don't remember us ever receiving such a PR, and if we did we'd just tell the PR author that they should not be using any editor that does that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The default is that the client installation sets the policy. If you care about line endings being consistent for your repo (and it sounds like you do), you should establish a policy via .gitattributes.
I've never seen that happen, but it sounds like you'd prefer LF to be checked in and LF to be checked out. That's a fine policy and I'll figure out what change to make to this file to encode that as a rule.
The default behavior of a Git for Windows install is to check out CRLF line endings and check in LF. But as some folks feel that version control shouldn't ever mess with files' line endings, if they were to configure their client this way, and created a new text file on Windows, they'd introduce a CRLF line ending file to your repo and you'd probably never notice. To be fair, you probably don't get that many PRs in a repo as highly specialized as this. And most of your contributors probably don't use Windows machines (which are more likely to try to rewrite things as CRLF. So while I accept that you haven't seen the PR that I describe so far, you can still save yourself and others the trouble of ever encountering that problem by encoding your line ending policy in your repo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Case in point, I just cloned this repo on linux WSL and the script failed because of a line ending issue:
Once this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No, the default is to leave line endings alone. The client installation can override that, but this is by far not the only client git configuration override that can end up breaking things.
It must have failed because you overrode the default policy in your user settings. (Note that "leave line endings alone" is also the default on Windows, for good reason.) That will break scripts in checked-out git repos on WSL in general, because WSL is Linux (just running in a VM), and it uses the Unix line-ending convention. There's nothing special about this repo that should require it to be defensive about user settings that are poorly chosen for the environment they're running in, when the vast majority of git repos aren't defensive in that way. In any case:
|
||||||||||
# Ensure shell scripts use LF line endings (linux only accepts LF) | ||||||||||
*.sh eol=lf | ||||||||||
*.ps1 eol=lf | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is unnecessary:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll remove it on the basis that you have no .ps1 scripts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is all fine.