Fix: show deleted worktree, related to issue 945#980
Fix: show deleted worktree, related to issue 945#980swellee wants to merge 4 commits intoTabbyML:mainfrom
Conversation
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #980 +/- ##
==========================================
- Coverage 15.90% 15.88% -0.03%
==========================================
Files 576 577 +1
Lines 52884 52958 +74
Branches 1704 1702 -2
==========================================
Hits 8411 8411
- Misses 44236 44309 +73
- Partials 237 238 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| const deletedWorktrees = useMemo( | ||
| () => | ||
| worktrees.filter( | ||
| (wt) => !activeWorktrees?.some((active) => active.path === wt.path), |
There was a problem hiding this comment.
It is recommended to query using activeWorktreePaths in the backend instead of filtering on the frontend
| return queryDb( | ||
| { | ||
| query: sql`select * from tasks where parentId is null and cwd = '${cwd}' order by updatedAt desc limit ${limit}`, | ||
| query: sql`select * from tasks where parentId is null and (cwd = '${cwd}' or git->>'$.worktree.gitdir' = '${cwd}') order by updatedAt desc limit ${limit}`, |
There was a problem hiding this comment.
Revert, querying only with the cwd is sufficient
There was a problem hiding this comment.
@liangfung briefly, to reproduce this bug, you can : let's say your current workspace=xx/main, then create worktree(eg: br-1) with vscode, and DO NOT switch to this worktree; then, hover on the worktree label on Pochi's panel, click the revealed menu btn "create task" on the worktree, hence, the new task was created with : cwd = current workspace(xx/main), and git.worktree.gitdir = xx/br-1, later you can delete the worktree br-1.
so that when you fetch deleted tasks, query by cwd= xx/br-1 won't get the task.
|
|
||
| return queryDb( | ||
| { | ||
| query: sql`select distinct git->>'$.worktree.gitdir' as path, git->>'$.branch' as branch, cwd from tasks where parentId is null and cwd != '${cwd}' ${originFilter} and git->>'$.worktree.gitdir' is not null`, |
There was a problem hiding this comment.
The value of the worktree path should be the cwd. When filtering, compare the cwd with activeWorktrees.

added: use-deleted-worktrees.ts, to gather deleted worktree paths from tasks;



modified: worktree-list, show deleted worktrees;