Skip to content

Broken gitattributes in repos and documentation #41

Open

Description

@emallen

The .gitattributes here follows an incorrect template from https://code.visualstudio.com/docs/devcontainers/tips-and-tricks.

* text=auto eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf

Curly braces are valid in editorconfig syntax but not in gitattributes.

Demonstration. Clone the container, as of a673af1, and from inside vscode's remote terminal run:

touch ex1.cmd
touch 'ex2.{cmd,CmD}'
git check-attr --all ex1.cmd
git check-attr --all ex2.\{cmd\,CmD\}

Output:

ex1.cmd: text: auto
ex1.cmd: eol: lf
ex2.{cmd,CmD}: text: set
ex2.{cmd,CmD}: eol: crlf

The solution is to use

*.[cC][mM][dD] text eol=crlf
*.[bB][aA][tT] text eol=crlf

Activity

  1. Daiyuanranfeng commented on Nov 10, 2026

    @Daiyuanranfeng

    I'd like to take this sample repo fix. I reproduced the LF checkout with the current patterns and verified that the bracket patterns give both batch extensions CRLF, including uppercase and mixed-case names. I have a PR ready for the sample's .gitattributes.

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

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