Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sh text eol=lf
6 changes: 6 additions & 0 deletions tests/repo-identity.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,10 @@ describe('repository identity', () => {
assert.doesNotMatch(installer, /STAR_REPLY/)
assert.doesNotMatch(installer, /echo " gh repo star/)
})

it('keeps shell installers LF-only so bash can parse them on every OS', () => {
const installer = readFileSync(join(root, 'scripts', 'install.sh'), 'utf8')

assert.doesNotMatch(installer, /\r\n/)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To ensure complete portability and prevent any carriage return characters from causing syntax errors in Bash, it is safer to assert the absence of any carriage return (\r) rather than specifically the CRLF sequence (\r\n). A lone \r can also cause issues in Unix environments.

Suggested change
assert.doesNotMatch(installer, /\r\n/)
assert.doesNotMatch(installer, /\r/)

})
})