Skip to content

fix(scripts): enforce LF line endings for shell scripts #1610

Description

@jkim323

Windows checkouts can convert tracked shell scripts to CRLF when Git uses core.autocrlf=true. ShellCheck then reports SC1017 on affected lines, creating widespread editor diagnostics even though the indexed scripts use LF.

Component

Development Environment

Steps to Reproduce

  1. Configure Git with core.autocrlf=true on Windows.
  2. Check out the repository without a shell-specific line-ending policy.
  3. Open a tracked .sh file in VS Code with ShellCheck diagnostics enabled.
  4. Observe SC1017 literal carriage-return errors.

Expected Behavior

Tracked .sh files use LF in the worktree regardless of the contributor's global Git line-ending configuration.

Environment

  • OS: Windows
  • Git setting: core.autocrlf=true
  • Editor: Visual Studio Code

Error Output

Literal carriage return. Run script through tr -d '\r' .

Acceptance Criteria

  • The root .gitattributes file declares *.sh text eol=lf.
  • .gitattributes is not excluded by .gitignore.
  • Every tracked .sh file resolves to text: set and eol: lf.
  • Normalization introduces no shell source-content drift.
  • Workspace diagnostics contain no SC1017 errors after files reload from disk.

Activity

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

Metadata

Metadata

Labels

bugSomething isn't workingneeds-triageNeeds initial review and categorization

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions