Merge pull request 'Fall back to prune-based removal for submodule-bearing worktrees' (#6) from fix/task-finish-remove into main
This commit was merged in pull request #6.
This commit is contained in:
+3
-1
@@ -127,7 +127,9 @@ cmd_finish() {
|
||||
echo "[verified] ${branch} 已包含于 origin/${TARGET_BRANCH};成果已落盘"
|
||||
fi
|
||||
git submodule deinit --all -f >/dev/null 2>&1 || true
|
||||
git -C "$mainrepo" worktree remove "$PWD" 2>/dev/null || { echo "finish: worktree remove 失败(含未清理内容)——已验证合入,可手动 rm -rf 后 git worktree prune" >&2; exit 1; }
|
||||
# git 对含 gitlink 的 worktree 无条件拒绝 remove(查索引,与 deinit 无关):
|
||||
# 已验证合入且子模块已 deinit 后,直接清目录并 prune。
|
||||
git -C "$mainrepo" worktree remove "$PWD" 2>/dev/null || { rm -rf "$PWD"; git -C "$mainrepo" worktree prune; }
|
||||
git -C "$mainrepo" branch -d "$branch" 2>/dev/null || git -C "$mainrepo" branch -D "$branch"
|
||||
git -C "$mainrepo" worktree prune
|
||||
git push -q --delete origin "$branch" 2>/dev/null || true
|
||||
|
||||
Reference in New Issue
Block a user