Skip to content

chore: add .gitattributes to normalize line endings#188

Merged
calesthio merged 1 commit into
calesthio:mainfrom
0xDevNinja:chore/gitattributes-line-endings
Jun 26, 2026
Merged

chore: add .gitattributes to normalize line endings#188
calesthio merged 1 commit into
calesthio:mainfrom
0xDevNinja:chore/gitattributes-line-endings

Conversation

@0xDevNinja

Copy link
Copy Markdown
Contributor

Summary

Adds a root .gitattributes to normalize line endings across platforms. Closes #187.

Without it, normalization depends on each contributor's local core.autocrlf. On Windows checkouts this can materialize text files — and shell scripts like render-demo.sh — with CRLF, which breaks script shebangs and produces noisy cross-platform diffs. This is the same class of Windows friction already seen in #172 and #148.

What it does

  • Defaults all text files to LF: * text=auto eol=lf
  • Pins newline-sensitive files (*.sh, Makefile, .env.example) to LF explicitly
  • Keeps *.bat / *.cmd as CRLF
  • Marks image/video/audio/font assets as binary so Git never normalizes or diffs them

Scope / safety

Only the policy file is added. Existing tracked files are intentionally left unrenormalized so the diff is a single new file and trivially reviewable. Maintainers can run git add --renormalize . in a separate commit whenever they want to apply it repo-wide.

Verified with git check-attr: .sh and .md resolve to text + eol=lf; diagram.png resolves to binary (untouched).

Without a .gitattributes, line-ending normalization depends on each
contributor's local core.autocrlf. On Windows checkouts this can
materialize text files — and shell scripts like render-demo.sh — with
CRLF, which breaks script shebangs and produces noisy cross-platform
diffs.

Add a root .gitattributes that:
- defaults all text files to LF (* text=auto eol=lf)
- pins shell scripts, Makefile and .env.example to LF explicitly
- keeps .bat/.cmd as CRLF
- marks image/video/audio/font assets as binary so Git never
  normalizes or diffs them

Only the policy file is added; existing files are intentionally left
unrenormalized to keep this change reviewable.

Closes calesthio#187
@0xDevNinja 0xDevNinja requested a review from calesthio as a code owner June 25, 2026 13:20

@calesthio calesthio left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM

@calesthio calesthio merged commit 7cda18d into calesthio:main Jun 26, 2026
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.

Add a .gitattributes to normalize line endings (prevent CRLF breakage on Windows)

2 participants