🐛 fix(vscode): worktreePath 消费侧统一解析 ~/绝对/相对,修复带 ~ 的存量工单与绝对路径 worktree 误判

新增 resolveWorktreePath(stored, workspaceRoot) 三态合一解析:开头 ~ 展开为 home、
已是绝对原样、相对拼到 workspaceRoot。替换全部消费点,原先「判 isAbsolute 再 join」
不认 ~、issueLoader 算 worktreeExists 更是裸 join 连绝对路径都拼坏。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-24 03:01:08 +08:00
co-authored by Claude Opus 4.7
parent 9a69aeed48
commit 5e7a3d20d9
4 changed files with 28 additions and 23 deletions
+2 -1
View File
@@ -19,6 +19,7 @@
import * as fs from 'node:fs'
import * as path from 'node:path'
import { resolveWorktreePath } from '../git/worktree'
import type { GiteaComment, GiteaIssue } from './api'
import type { Issue, IssueColumn } from './types'
import {
@@ -354,7 +355,7 @@ async function buildIssue(opts: {
let worktreeExists: boolean | undefined
if (worktreePath && workspaceRoot) {
try {
worktreeExists = fs.existsSync(path.join(workspaceRoot, worktreePath))
worktreeExists = fs.existsSync(resolveWorktreePath(worktreePath, workspaceRoot))
}
catch {
worktreeExists = false