Skip to content

fix: resolve local excludes through Git in linked worktrees (#446) - #455

Open
kiki830621 wants to merge 1 commit into
mainfrom
idd/446-worktree-exclude-path
Open

kiki830621 wants to merge 1 commit into
mainfrom
idd/446-worktree-exclude-path

Conversation

@kiki830621

Copy link
Copy Markdown
Member

linked worktree 中的 idd-issue 與 idd-config 原本將本機排除規則寫進 worktree 專用管理目錄,helper 雖回傳成功,Git 卻不讀取該檔案。本次將兩處 target 改為 git rev-parse --git-path info/exclude,使 .claude/.idd/ 與既有 legacy 設定檔確實被忽略。

Refs #446

修改範圍

  • 以最新 main(da47674a8bd25cdbb0d8fec5872a0ac0792cea56)為基礎;實際路徑為 plugins/issue-driven-dev/skills/{idd-issue,idd-config}/SKILL.md。
  • 保留既有 patterns、marker、排除規則語義、helper 介面與 .gitignore 行為。
  • 新增 scripts/tests/git-exclude-callers/,由現有 run-all-tests.sh 自動收錄。測試直接擷取並執行兩份 SKILL.md 中的 third-party exclude Bash 區塊,不複製呼叫指令。
  • 補上 CHANGELOG 的 Unreleased 紀錄。

Helper 評估與其他 PR

main 的 helper 目前僅檢查 basename;#431 的較嚴格路徑驗證仍在 PR #448。已讀取該實作:它確認 <git-dir>/info/exclude 屬於真實 Git 管理目錄,但仍接受 linked worktree 中 Git 不會讀取的專用 exclude 路徑。

本次採最小呼叫端修正,不新增 helper 拒絕條件。修正後的 common-directory 路徑可通過 main 與 PR #448 兩種 helper;已將 #448 helper 放入隔離副本實際執行全部六組新回歸案例,全部通過。若另行收緊 helper,舊呼叫端會由成功變成 exit 2,這屬額外契約變更,解決本 issue 並不需要。直接傳入舊的錯誤路徑仍不受 helper 防護,本 PR 不宣稱已封堵所有外部錯誤呼叫。

既有 idd-edit-helper.py::_ensure_ignored 已採用相同的 --git-path 解析,無須修改。PR #402 調整兩處相鄰的 $CLAUDE_PLUGIN_ROOT 寫法;本 PR 保留該行,整合時應保留兩邊各自修改。

驗證

  • Git 2.51.1 下先執行新測試,再修正:兩個原始呼叫端在 linked worktree 都出現 helper exit 0、git check-ignore exit 1;其他配置通過。
  • 修正後:兩個呼叫端 × 一般 repository/linked worktree/separate git directory,共六組案例通過。全部使用含空格的暫存路徑。
  • 檢查實際 git check-ignore、git status、三種設定檔、未忽略的對照檔、既有使用者規則、重複執行位元組不變與單一 marker 區塊;linked worktree 額外檢查 common exclude 對主工作樹生效,且未建立無效的 worktree 專用 exclude。
  • 新測試移除繼承的 GIT_* 與 shell 啟動注入設定,隔離 HOME/Git 設定/templates。另以帶有 GIT_DIR、GIT_WORK_TREE、GIT_COMMON_DIR、GIT_INDEX_FILE 和 indexed config 的外部測試 repository 驗證:測試通過,外部 repository 的檔案位元組不變,未建立外部 index。
  • 完整測試:bash plugins/issue-driven-dev/scripts/run-all-tests.sh → 64 suites, 0 failed(隔離 Git 環境並安裝專案固定版本的 Python 相依套件)。
  • git diff --check 通過。測試只使用空白的暫存設定檔,診斷不輸出設定檔內容。

本機重跑:

bash plugins/issue-driven-dev/scripts/tests/git-exclude-callers/test.sh

等待專案既有 review/驗證與結案流程;未合併,未關閉 issue。

Use --git-path info/exclude in both third-party setup callers while preserving patterns and helper behavior. Execute the actual skill blocks in isolated ordinary, linked-worktree, and separate-git-dir fixtures.

Refs #446
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant