# 统一行尾,避免 Windows 上 CRLF/LF 反复抖动。 # # 背景:git 在 Windows 默认 core.autocrlf=true,会把仓库里的 LF 转成工作区的 CRLF。 # 而 ruff format 的 line-ending = "auto" 会跟着工作区走,结果就是 # "格式化 → 提交 → 换台机器再格式化" 永远在改行尾,diff 里全是噪音。 # 这里显式钉死:文本文件一律 LF。 * text=auto eol=lf # Python / 配置 / 文档:明确 LF *.py text eol=lf *.pyi text eol=lf *.toml text eol=lf *.lock text eol=lf *.md text eol=lf *.json text eol=lf *.txt text eol=lf *.proto text eol=lf # Windows 批处理必须是 CRLF,否则 cmd 解析会出错 *.bat text eol=crlf *.cmd text eol=crlf # 二进制:不做任何行尾转换 *.png binary *.jpg binary *.ico binary *.gif binary *.woff binary *.woff2 binary