Skip to content

Rationale for specifying line endings in .gitattributes generally, and specifically for *.ps1 files. #174

@blakeNaccarato

Description

@blakeNaccarato

I initially stumbled upon this when seeing *.ps1 has eol=crlf. Merged PR #125 assumes that PowerShell is cross-platform and therefore shouldn't have CRLF specified, while the merged PR #129 overrides the previous one and assumes it is Windows-specific. I think that *.ps1 files shouldn't have CRLF specified by default, since teams can use PowerShell as their terminal on both Windows and Unix-like systems.

The general question of whether line endings should be coerced at all in .gitattributes is worth asking. This guide suggests that .gitattributes overrides the core.autocrlf setting, which could be surprising for the uninitiated. I personally prefer using core.autocrlf to standardize across platforms, and line ending overrides in .gitattributes are surprising to me, at least.

I'm curious as to your rationale for specifying line endings in .gitattributes. I think it's fine whatever you decide! But maybe a disclaimer is warranted in the readme, as to the philosophy behind this decision. If it's signposted, then users with a different mindset can remove those EOL specifications. I know it's hard to devise a single "source of truth" for anything, let alone the esoteric details behind .gitattributes, so to attempt to standardize on anything at all is an admirable effort.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions