From ec64da192647fed4ee40338f9d4802fdaa120023 Mon Sep 17 00:00:00 2001 From: HONOR Date: Sat, 31 Oct 2026 15:57:46 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=A3=B0=E6=98=8E=E6=8D=A2=E8=A1=8C?= =?UTF-8?q?=E7=AC=A6=E7=AD=96=E7=95=A5=E4=B8=BA=20LF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 .gitattributes:* text=auto eol=lf + 二进制白名单,策略落在仓库层而非本机 core.autocrlf - 新增 .editorconfig:编辑器侧强制 utf-8 / LF / 末尾空行 - 背景:本机 core.autocrlf=true 且仓库无声明,出现 diff 为空却恒显 modified 的幻影脏文件(ENG-001) - 已 renormalize 全库,索引与工作区均为 LF --- .editorconfig | 20 ++++++++++++++++++++ .gitattributes | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitattributes diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..2800648 --- /dev/null +++ b/.editorconfig @@ -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 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..2c5da90 --- /dev/null +++ b/.gitattributes @@ -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