chore: 声明换行符策略为 LF

- 新增 .gitattributes:* text=auto eol=lf + 二进制白名单,策略落在仓库层而非本机 core.autocrlf
- 新增 .editorconfig:编辑器侧强制 utf-8 / LF / 末尾空行
- 背景:本机 core.autocrlf=true 且仓库无声明,出现 diff 为空却恒显 modified 的幻影脏文件(ENG-001)
- 已 renormalize 全库,索引与工作区均为 LF
This commit is contained in:
HONOR
2026-10-31 15:57:46 +08:00
parent f87610e047
commit ec64da1926
2 changed files with 70 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
root = true
# 换行符与字符集的编辑器侧约束(ENG-001 的辅助机制,仓库层策略以 .gitattributes 为准)
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
[*.md]
# Markdown 的行尾双空格是硬换行语法,不做清理
trim_trailing_whitespace = false
[*.{json,json5,yml,yaml}]
indent_size = 2
[{*.ets,*.ts,*.js,*.mjs}]
indent_size = 2
+50
View File
@@ -0,0 +1,50 @@
# 换行符策略:在仓库层声明,不依赖任何机器本地的 core.autocrlf(ENG-001)
# 入库经 clean 过滤归一为 LF、检出保持 LF;避免"diff 为空却恒显 modified"的幻影脏文件。
* text=auto eol=lf
# 文本文件显式声明(覆盖 text=auto 的猜测)
*.ets text eol=lf
*.ts text eol=lf
*.js text eol=lf
*.mjs text eol=lf
*.cjs text eol=lf
*.json text eol=lf
*.json5 text eol=lf
*.md text eol=lf
*.ps1 text eol=lf
*.sh text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
*.xml text eol=lf
*.txt text eol=lf
*.svg text eol=lf
*.gitignore text eol=lf
*.gitattributes text eol=lf
*.editorconfig text eol=lf
# 二进制白名单(禁止任何换行转换)
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.webp binary
*.ico binary
*.bmp binary
*.ttf binary
*.otf binary
*.woff binary
*.woff2 binary
*.so binary
*.a binary
*.hap binary
*.app binary
*.har binary
*.hsp binary
*.zip binary
*.gz binary
*.7z binary
*.db binary
*.mp4 binary
*.mp3 binary
*.wav binary
*.jar binary