From 766c3cf5ffc8e190c06cab6ce01094958d656f15 Mon Sep 17 00:00:00 2001 From: Chris Wolfgang Date: Sat, 9 May 2026 20:20:45 -0400 Subject: [PATCH 1/2] chore: sync *.ps1 EOL fix from canonical (repo-template #347 + #348) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes the CRLF + UTF-8-BOM overrides for *.ps1 files in .gitattributes and .editorconfig. Required for the '#!/usr/bin/env pwsh' shebang at the top of every script in scripts/ to work as an executable on Linux/macOS. No file content rewrites — index has been LF the whole time. Only attr declarations align with reality now. Co-Authored-By: Claude Opus 4.7 (1M context) --- .editorconfig | 9 +++++---- .gitattributes | 13 ++++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.editorconfig b/.editorconfig index c055ade..df34937 100644 --- a/.editorconfig +++ b/.editorconfig @@ -26,12 +26,13 @@ indent_size = 2 indent_size = 2 # PowerShell files -# PowerShell uses CRLF to maintain compatibility with Windows and PowerShell conventions -# This overrides the global end_of_line = lf setting and aligns with .gitattributes line 14 +# Only the indent override is needed; LF + UTF-8 (no BOM) come from the +# global [*] section above. LF + no-BOM is required for the +# `#!/usr/bin/env pwsh` shebang at the top of every script in scripts/ +# to work on Linux/macOS — CR breaks the kernel's exec lookup, and a +# leading BOM prevents shebang recognition entirely. [*.ps1] indent_size = 4 -end_of_line = crlf -charset = utf-8-bom # C# files [*.cs] diff --git a/.gitattributes b/.gitattributes index 85e6969..2dd9f22 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,11 +9,14 @@ *.fsx text eol=lf # Scripts -# PowerShell scripts: CRLF line endings (intentional override) -# Both .gitattributes and .editorconfig consistently configure PowerShell files -# to use CRLF (Windows-style) line endings for PowerShell convention compliance. -# See .editorconfig [*.ps1] section for the matching configuration. -*.ps1 text eol=crlf +# PowerShell scripts: LF line endings, no BOM. Required for the +# `#!/usr/bin/env pwsh` shebang to work on Linux/macOS — the kernel +# parses CR as part of the interpreter name (looking for `pwsh\r`), +# and a UTF-8 BOM before `#!` prevents shebang recognition entirely. +# Modern PowerShell 7+ handles LF on Windows transparently; Git's +# autocrlf still gives Windows users CRLF in their working tree if +# desired without forcing CRLF into the index. +*.ps1 text eol=lf # Build and configuration files From 02e3dde54f2f947a2b35b90feb861e7c8097de39 Mon Sep 17 00:00:00 2001 From: Chris Wolfgang <210299580+Chris-Wolfgang@users.noreply.github.com> Date: Wed, 13 May 2026 16:52:18 -0400 Subject: [PATCH 2/2] Address Copilot review nits on .editorconfig / .gitattributes - .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) --- .editorconfig | 16 +++++++--------- .gitattributes | 16 +++++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.editorconfig b/.editorconfig index df34937..9800e31 100644 --- a/.editorconfig +++ b/.editorconfig @@ -25,15 +25,13 @@ indent_size = 2 [*.{yml,yaml}] indent_size = 2 -# PowerShell files -# Only the indent override is needed; LF + UTF-8 (no BOM) come from the -# global [*] section above. LF + no-BOM is required for the -# `#!/usr/bin/env pwsh` shebang at the top of every script in scripts/ -# to work on Linux/macOS — CR breaks the kernel's exec lookup, and a -# leading BOM prevents shebang recognition entirely. -[*.ps1] -indent_size = 4 - +# PowerShell files inherit LF + UTF-8 (no BOM) + 4-space indent from +# the global [*] section above — no [*.ps1] override needed. The +# `charset = utf-8` setting is what prevents editors from writing a +# BOM, which together with the LF requirement keeps the +# `#!/usr/bin/env pwsh` shebang (where present) on scripts under +# `scripts/` working on Linux/macOS — CR breaks the kernel's exec +# lookup, and a leading BOM prevents shebang recognition entirely. # C# files [*.cs] diff --git a/.gitattributes b/.gitattributes index 2dd9f22..150a537 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,13 +9,15 @@ *.fsx text eol=lf # Scripts -# PowerShell scripts: LF line endings, no BOM. Required for the -# `#!/usr/bin/env pwsh` shebang to work on Linux/macOS — the kernel -# parses CR as part of the interpreter name (looking for `pwsh\r`), -# and a UTF-8 BOM before `#!` prevents shebang recognition entirely. -# Modern PowerShell 7+ handles LF on Windows transparently; Git's -# autocrlf still gives Windows users CRLF in their working tree if -# desired without forcing CRLF into the index. +# PowerShell scripts: LF line endings in the index. Required for the +# `#!/usr/bin/env pwsh` shebang (where present) to work on Linux/macOS +# — the kernel parses CR as part of the interpreter name (looking for +# `pwsh\r`). BOM avoidance is enforced separately via `.editorconfig` +# (`charset = utf-8` in the global `[*]` section); git attributes can +# only normalize line endings, not byte-order marks. The top-of-file +# `* text=auto eol=lf` rule also means Windows users get LF in their +# working tree regardless of `core.autocrlf` — intentional so the +# shebang works there too. *.ps1 text eol=lf