行尾策略写死进 .gitattributes(统一 LF、bat 强制 CRLF、二进制显式标注),根治重生成后的行尾幻影改动

This commit is contained in:
2026-10-10 01:15:16 +08:00
parent 53bd9af02e
commit 63ee090fd1
2 changed files with 28 additions and 0 deletions
+27
View File
@@ -1 +1,28 @@
# ===== 行尾策略(2026-10-09 定,勿删本段)=====
# 仓库 blob 与检出工作区统一 LF。原因:CubeMX 重生成写的是 **LF**,而此前工作区的行尾
# 由每台机器各自的 `core.autocrlf` 决定(本机 = true → 检出成 CRLF),于是每次重生成后
# 40+ 个第三方文件在 `git status` 里显示"已修改"(内容归一化后其实完全一致)。
# 写死属性后,行为不再依赖各机的 `core.autocrlf`,换机器 / 重新 clone 也不会复发。
* text=auto eol=lf
# 批处理脚本必须 CRLF:cmd.exe 对 LF-only 文件里的 goto/标签处理不可靠
*.bat text eol=crlf
*.cmd text eol=crlf
# 二进制显式标注(`text=auto` 靠内容嗅探,PNG 未走 LFS,尤其要写死)
*.png binary
*.gif binary
*.ttf binary
*.otf binary
*.ico binary
*.dll binary
*.lib binary
*.a binary
*.o binary
*.exe binary
*.bin binary
*.zip binary
*.pdf binary
# LFS 图片:必须排在 `*` 之后才能覆盖它(-text 使其不参与行尾转换)
*.jpg filter=lfs diff=lfs merge=lfs -text