Skip to content

Add .gitattributes to enforce LF line endings for .editorconfig - #387

Merged
xuhdev merged 2 commits into
masterfrom
copilot/add-gitattributes-file
Dec 24, 2025
Merged

xuhdev merged 2 commits into
masterfrom
copilot/add-gitattributes-file

Conversation

Copilot AI commented Dec 24, 2025 •

Copy link
Copy Markdown
Contributor

On Windows, Git's default autocrlf behavior converts LF to CRLF on checkout, causing .editorconfig files with end_of_line = lf to have inconsistent line endings. This breaks the EditorConfig parser, which fails silently when the file's actual line endings contradict its declared end_of_line setting.

Changes

  • Added .gitattributes with text eol=lf directive for .editorconfig to prevent Git from performing line ending conversion on any platform

This ensures the parser receives files with consistent line endings matching the repository's EditorConfig specification.

Original prompt

Problem

The Windows CI is failing because Git automatically converts LF line endings to CRLF when checking out files on Windows. This causes the .editorconfig file to contain \r\n line endings, which breaks the EditorConfig parser when the file specifies end_of_line = lf.

This is related to issue #380 where end_of_line = lf prevents the entire .editorconfig from loading on Windows.

Solution

Add a .gitattributes file to the repository that ensures the .editorconfig file always uses LF line endings, regardless of the platform.

Implementation

Create a new .gitattributes file in the repository root with the following content:

# Ensure .editorconfig always uses LF line endings
.editorconfig text eol=lf

This will prevent Git from converting line endings in the .editorconfig file on Windows, fixing the CI failures.

This pull request was created from Copilot chat.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

This fixes Windows CI failures where Git automatically converts LF to CRLF,
causing the EditorConfig parser to fail when `end_of_line = lf` is specified.

Fixes #380

Co-authored-by: xuhdev <325476+xuhdev@users.noreply.github.com>
@xuhdev
xuhdev marked this pull request as ready for review December 24, 2025 07:17
Copilot AI changed the title [WIP] Add .gitattributes to enforce LF line endings for .editorconfig Add .gitattributes to enforce LF line endings for .editorconfig Dec 24, 2025
Copilot AI requested a review from xuhdev December 24, 2025 07:18
@xuhdev
xuhdev enabled auto-merge (squash) December 24, 2025 07:19
@xuhdev
xuhdev disabled auto-merge December 24, 2025 07:19
@xuhdev
xuhdev enabled auto-merge (squash) December 24, 2025 07:19
@xuhdev
xuhdev merged commit 646c31b into master Dec 24, 2025
9 of 11 checks passed
@xuhdev
xuhdev deleted the copilot/add-gitattributes-file branch December 24, 2025 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants