主区在飞积压收口批:active.md 台账317-326补记账(迭代11三批+出口包+双BD+MC档位并行批正文落籍)+worktree-guard.sh 兄弟worktree豁免修复(2026-10-03用户授权)——用户令该提交的都提交;battle_orchestrator.gd tab噪音与project.godot裁决行已还原、playnote.md留用户手迹、config.json留本机环境件不提交

This commit is contained in:
DKChan committed 2026-10-03 21:00:21 +08:00
1 parent 3ec5bcbe61
commit ff3fe8f19c
2 files changed
+71 -1

No files matched your search

+7
View File
@@ -92,6 +92,13 @@ elif tool == "Bash":
# 主工作区判定:cwd 在内,或命令文本里显式指到主工作区路径(不含 worktree 兄弟目录)
norm = cmd.replace("\\", "/").lower()
ref_main = re.search(r"/d/code/g-plan2(?![\w-])", norm) or re.search(r"d:/code/g-plan2(?![\w-])", norm)
# 兄弟 worktree 豁免(2026-10-03 用户授权修复):harness 上报 cwd 恒为项目根,原判定把
# git -C <worktree> commit 一并误拦,与「提交在任务 worktree 分支上完成」的放行语义相抵;
# 命令文本以路径形态(斜杠前缀)显式指向兄弟 worktree 且不含主区路径时放行——显式主区
# 路径引用优先走下方拦截判定(ref_main 命中即不豁免,防「主区提交夹带 worktree 提及」绕行)。
ref_wt = re.search(r"/g-plan2-[\w-]+", norm)
if ref_wt and not ref_main:
sys.exit(0)
if (in_dir(cwd, proj) or ref_main) and trunk_branch(proj) in TRUNK:
sys.stderr.write(
"[worktree 铁律] 主工作区(master)禁止直接 git commit——提交在任务 worktree 分支上完成,"