.gitattributes 1.4 KB

12345678910111213141516171819202122232425262728
  1. # 观澜 · 只钉"换行/编码本身就是功能"的那几个入口文件
  2. #
  3. # 为什么需要它(2026-09-16/17 一天内实炸两次):
  4. # · `install.ps1` 掉 UTF-8 BOM → Windows PowerShell 5.1 按 ANSI/GBK 解码 → 中文乱码 + 级联 ParserError,
  5. # 目标机 `install` 1 秒即退出;
  6. # · `install.sh` 从写出来起就是 CRLF(git blob 就是 CRLF)→ POSIX 语义下每个词尾粘 `\r`:
  7. # `set -e` 变成非法选项、`RT=""` 变成 `RT="\r"` 把后面的 `-n "$RT"` 判断翻面
  8. # → 此前所有交付包的 Linux/macOS 安装脚本都是坏的。
  9. # 机器侧的强制执行在 `src/entry_refs.py::encoding_problems()`(打包 / 开箱验证 / 装机自检各查一遍);
  10. # 这里把 checkout 也钉死,免得"某次 git checkout / clone 之后又变回去"。
  11. #
  12. # ★ 刻意**不**声明 *.py / *.md / *.json / *.yaml 的 eol:
  13. # 仓库里这些文件历来混着 CRLF(实测 .py 245 件里 42 件是 CRLF,且 2dad1a2 时就如此),
  14. # Python/JSON 对两种换行都能读;为纯 EOL 去改 40+ 个文件、把历史 diff 冲掉,不划算。
  15. # 只有"解释器/解析器会因此报错"的文件才值得钉死。
  16. *.sh text eol=lf
  17. *.bat text eol=crlf
  18. *.ps1 text eol=crlf
  19. # 二进制/特殊编码:禁止任何换行转换
  20. *.parquet -text
  21. *.npz -text
  22. *.zip -text
  23. *.png -text
  24. *.jpg -text
  25. *.ico -text
  26. *.docx -text
  27. *.pdf -text