From d41cb49a45447f2a222d443b6b92e117dc7ef164 Mon Sep 17 00:00:00 2001 From: LittleYellow Date: Thu, 23 Jul 2026 08:23:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8A=A0=20.gitattributes=20=E5=B0=8D?= =?UTF-8?q?=20raw/**=20=E9=97=9C=E9=96=89=E6=8F=9B=E8=A1=8C=E6=AD=A3?= =?UTF-8?q?=E8=A6=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit core.autocrlf=true 下,已 commit 的 raw/converted/*.md 於 Windows checkout 會被 git 轉成 CRLF,使磁碟 bytes 與 manifest 登記的 LF-hash 不符、--verify 誤報 mismatch——在 git 層抵銷了轉換器的 write_bytes 修復。以 `raw/** -text` 把「登記 hash == 磁碟 bytes」的不變式延伸到 git 的 checkin/checkout。 AGENTS.md §1.4 補記此機制。 Co-Authored-By: Claude Opus 4.8 --- .gitattributes | 8 ++++++++ AGENTS.md | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8b3993b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,8 @@ +# raw/ 是 hash 釘選的 provenance 帳本(AGENTS.md §1.4 / §9 / §14): +# git 一律不得正規化其換行,否則 checkout 後磁碟 bytes 會與 manifest 的 +# SHA-256 不符,讓 --verify 對帳失準(本專案 core.autocrlf=true)。 +# 轉換器已在寫入時以 write_bytes 固定為登記的那份 bytes;此處把同樣的 +# 保證延伸到 git 的 checkin/checkout。 +raw/originals/** -text +raw/converted/** -text +raw/manifest.json -text diff --git a/AGENTS.md b/AGENTS.md index 6be8464..c301c64 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -28,7 +28,8 @@ SHA-256 至 `raw/manifest.json`(結構見 §9),轉換檔條目必須回指原始檔 hash。 wiki 頁面引用來源必須帶 `source_ref`(格式見 §3.3)。登記的 hash 必須等於檔案在 磁碟上的實際 bytes(UTF-8,換行不轉換——轉換器一律以 write_bytes 寫入所登記的 - 那份 bytes,不受平台 CRLF 影響);完整性以 §14 `--verify` 稽核。 + 那份 bytes,不受平台 CRLF 影響;git 亦以 `.gitattributes` 對 `raw/**` 關閉換行 + 正規化,避免 checkout 重新引入 CRLF);完整性以 §14 `--verify` 稽核。 5. **HITL 閘門**:所有 wiki 層的變更以 git branch + PR 形式提交,經人工審核後才 合併至 main。攝入腳本永遠不直接 commit 到 main。lint 絕不擅自刪檔,一律標記 待人工核准。