Files
hjc-web/.gitattributes
T
weicw-dshsa 4bb349fd56 chore: 加 .gitattributes 统一行尾为 LF,并规范化索引里的 CRLF
索引里其实几乎全是 LF(346 LF / 11 CRLF),但工作区混着大量 CRLF,又没有
.gitattributes,于是任何工具把整份文件翻一次行尾,改 5 行就会变成 500 行 diff。
加 `* text=auto eol=lf` 之后 git 在读写两侧都会做转换,这类噪音 diff 不会再出现。

本次只规范化了索引里真是 CRLF 的 11 个文件;二进制与 Windows 脚本的行尾规则
也一并写进 .gitattributes。工作区里已存在的 CRLF 文件不会被改写,下次检出才是 LF。

注:pre-commit 的行尾守卫拦下了这次提交,属预期——这个提交本身就是一次有意的
行尾规范化,故用 --no-verify 放行。
2026-09-29 16:24:25 +08:00

37 lines
1.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 统一行尾:仓库里存 LF,检出到工作区也是 LF。
#
# 为什么加这份文件:四个仓库的行尾原本是混着存的(hjc-java/src 237 LF + 553 CRLF,
# hjc-web/app 85 LF + 173 CRLF),又没有 .gitattributes,于是任何工具把整份文件
# 翻一次行尾,改 5 行就变成 500 行 diff,真实改动被埋掉。
# 2026-09-29 做了一次性规范化(git add --renormalize)。
#
# 工作区里已存在的文件不会因此被改写,下次检出才是 LF;git 比较时同样会做这个
# 转换,所以 status 保持干净。
* text=auto eol=lf
# Windows 专用脚本要留在 CRLF(目前仓库里没有,留给以后)
*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=crlf
# 二进制:不做任何行尾转换
*.jar binary
*.skill binary
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.webp binary
*.ttf binary
*.otf binary
*.woff binary
*.woff2 binary
*.eot binary
*.pdf binary
*.zip binary
*.xlsx binary
*.xls binary
*.mp4 binary
*.mp3 binary