🐛 fix(vscode): 实施启动自动丢掉残留 worktree 再新建
This commit is contained in:
@@ -23,6 +23,7 @@ import { getSettings } from '../../settings/store'
|
||||
import { webhookCoordinator } from '../../webhook/coordinator'
|
||||
import { decideAutoReviewPath } from '../autoReviewDecision'
|
||||
import { makeNonce } from '../KanbanPanel'
|
||||
import { cleanupFeatureBranch } from './branchCleanup'
|
||||
|
||||
export async function handleResumeSession(panel: KanbanWebviewPanel, sessionId: string, profilePath?: string, relCwd?: string, issueNumber?: number): Promise<void> {
|
||||
// kind 跟着 sessionRole 提前判定(原来散落在方法中部,提到入口是为了构造
|
||||
@@ -798,6 +799,17 @@ export async function handleImplement(
|
||||
|
||||
// 先保证 worktree 可用:后面写 state / 开终端都依赖实际 path。
|
||||
try {
|
||||
// 先清远程残留;本地 leftover 由 ensureWorktree 丢掉。必须在 add -b 之前,
|
||||
// 否则 cleanup 会把刚建的新分支删掉。live worktree 上本地 -D 失败只 warn。
|
||||
await cleanupFeatureBranch({
|
||||
workspaceRoot,
|
||||
branch,
|
||||
issueNumber,
|
||||
devBranch: settings.devBranch,
|
||||
autoBuildBranch: settings.autoBuildBranch,
|
||||
remote,
|
||||
token,
|
||||
})
|
||||
// worktree 现在建在工作区外(~/Sources/worktree/<项目>/...),父目录可能不存在;
|
||||
// git worktree add 不会创建多层父目录,先补齐。
|
||||
await fsp.mkdir(path.dirname(worktreePath), { recursive: true })
|
||||
|
||||
Reference in New Issue
Block a user