chore: sync *.ps1 EOL fix from canonical#81
Closed
Chris-Wolfgang wants to merge 4 commits into
Closed
Conversation
Removes the CRLF + UTF-8-BOM overrides for *.ps1 files. Required for the '#!/usr/bin/env pwsh' shebang at the top of scripts/ to work as an executable on Linux/macOS. No file content rewrites — index has been LF the whole time. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Aligns repository formatting rules with the canonical template so PowerShell scripts can be executed cross-platform via the #!/usr/bin/env pwsh shebang (avoiding CRLF/BOM-related shebang failures on Linux/macOS).
Changes:
- Update
.gitattributesto normalize*.ps1files toeol=lfand document the shebang rationale. - Remove
end_of_line = crlfandcharset = utf-8-bomoverrides from.editorconfig’s[*.ps1]section so defaults (lf,utf-8) apply.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
.gitattributes |
Switches *.ps1 normalization from CRLF to LF and updates the rationale comments. |
.editorconfig |
Removes PowerShell-specific CRLF/BOM overrides so global UTF-8 + LF defaults apply. |
- .editorconfig: drop the [*.ps1] section entirely. Its only rule (indent_size = 4) was a no-op since the global [*] section already sets indent_size = 4. The shebang-rationale comment now sits as a top-level note explaining why no override is needed, and is honest that the shebang is only present 'where present' rather than in 'every script in scripts/'. - .gitattributes: tighten the *.ps1 comment so it doesn't imply that `eol=lf` prevents a BOM. Git attributes can only normalize line endings; BOM avoidance is enforced via .editorconfig's charset setting. Also clarify that `* text=auto eol=lf` (top of file) takes precedence over core.autocrlf, so the previous claim about Windows users getting CRLF in their working tree was inaccurate. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
Author
|
Superseded by the C1 template-drift re-sync — the canonical |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Syncs the canonical
*.ps1EOL fix from repo-template#347 + #348. Removes the CRLF + UTF-8-BOM overrides for*.ps1files in.gitattributesand.editorconfig.Why
The
#!/usr/bin/env pwshshebang at the top of every script inscripts/doesn't work as an executable on Linux/macOS when files are stored with CRLF + BOM:#!/usr/bin/env pwsh\rand tries to find an interpreter namedpwsh\r— fails.EF BB BFappear before#!, so the kernel doesn't recognize the file as a shebang script at all.Changes
.gitattributes*.ps1 text eol=crlf(with CRLF-rationale comment)*.ps1 text eol=lf(with shebang-rationale comment).editorconfig [*.ps1]end_of_line = crlf,charset = utf-8-bom[*]defaults)What does NOT change
Files in the index were already LF. No file content rewrites.
Note about the protected-files guard
This PR touches
.editorconfig(protected).Detect .NET Projectswill fail it. Maintainer override required.Test plan
git ls-files --eol scripts/*.ps1showsi/lf w/* attr/text eol=lf