From 5ae7068a4119acaf68d44832ac1bb2882c7d7f6c Mon Sep 17 00:00:00 2001 From: Alessandro De Blasis Date: Thu, 26 Mar 2026 02:17:36 +0100 Subject: [PATCH] build: normalize line endings to LF across all platforms Add explicit file-type rules to .gitattributes so text files are stored and checked out with LF line endings regardless of platform. This prevents issues where Windows git (or CI actions/checkout) converts LF to CRLF, breaking comptime parsers that split embedded files by '\n' and end up with trailing '\r' in parsed tokens. Key changes: - Source code (*.zig, *.c, *.h, etc.): always LF - Config/build files (*.zon, *.nix, *.md, etc.): always LF - Text data files (*.txt): always LF (for embedded file parsing) - Windows resource files (*.rc, *.manifest): preserve as-is (native Windows tooling expects CRLF) - Binary files: explicitly marked as binary Removed the legacy rgb.txt -text rule since *.txt now handles it uniformly with code-level CRLF handling as defense-in-depth. --- .gitattributes | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 2e976e5f9..c5d954680 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,42 @@ +# Source code - always LF +*.zig text eol=lf +*.c text eol=lf +*.h text eol=lf +*.cpp text eol=lf +*.m text eol=lf +*.swift text eol=lf +*.py text eol=lf +*.sh text eol=lf + +# Config/build files - always LF +*.zon text eol=lf +*.nix text eol=lf +*.md text eol=lf +*.json text eol=lf +*.yml text eol=lf +*.yaml text eol=lf +*.toml text eol=lf +CMakeLists.txt text eol=lf +*.cmake text eol=lf +Makefile text eol=lf + +# Text data files - always LF (embedded in Zig, parsed with \n split) +*.txt text eol=lf + +# Windows resource files - preserve as-is (native Windows tooling) +*.rc -text +*.manifest -text + +# Binary files +*.png binary +*.ico binary +*.icns binary +*.ttf binary +*.otf binary +*.glsl binary +*.blp binary + +# Linguist overrides build.zig.zon.nix linguist-generated=true build.zig.zon.txt linguist-generated=true build.zig.zon.json linguist-generated=true @@ -12,4 +51,3 @@ src/font/nerd_font_attributes.zig linguist-generated=true src/font/nerd_font_codepoint_tables.py linguist-generated=true src/font/res/** linguist-vendored src/terminal/res/** linguist-vendored -src/terminal/res/rgb.txt -text