iter(g347): iter done 加分支护栏

This commit is contained in:
HIsheR
2026-10-27 02:31:56 +08:00
parent 0e1c3c93ec
commit 9172287e0d
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -2155,6 +2155,12 @@ function cmdIter(args) {
process.exit(2);
}
if (!/^[0-9a-f]{7,40}$/.test(commit)) { console.error(`commit 须为 7-40 位短哈希:${commit}`); process.exit(2); }
// 分支护栏:留痕写进 backlog 之后才发现分支错了,等于把一轮迭代记在别人头上(历史事故:提交直落 qa/stable)
const branch = spawnSync('git', ['branch', '--show-current'], { cwd: ROOT }).stdout?.toString().trim() ?? '';
if (branch !== 'qa/probe' && !process.argv.includes('--force')) {
console.error(`iter done 只能在 qa/probe 上收尾(当前 ${branch || '游离 HEAD'}):这轮提交若落在 qa/stable,probe 远端会原地不动。确认要在这里留痕就加 --force`);
process.exit(2);
}
const data = load();
const items = itemsOf(data);
const item = items.find((i) => i.id === id);