Skip to content

Commit 74bdc3f

Browse files
committed
Keep worktree list in sync after deleting a worktree
This affects both our showWorktreesInRepoList feature as well as the upstream worktrees implementation. Should replace with the upstream fix once it's ready
1 parent 2fb4b6c commit 74bdc3f

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

app/src/lib/stores/app-store.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6770,7 +6770,6 @@ export class AppStore extends TypedBaseStore<IAppState> {
67706770
force?: boolean
67716771
): Promise<void> {
67726772
const isDeletingCurrentWorktree = repository.path === worktreePath
6773-
let path = repository.path
67746773
let originalWorktree: WorktreeEntry | null = null
67756774

67766775
if (isDeletingCurrentWorktree) {
@@ -6783,14 +6782,11 @@ export class AppStore extends TypedBaseStore<IAppState> {
67836782
throw new Error('Could not find main worktree')
67846783
}
67856784

6786-
await this._switchWorktree(repository, main)
6787-
// Run the delete worktree action with the main worktree path since the current
6788-
// worktree path will be deleted after the switch.
6789-
path = main.path
6785+
repository = await this._switchWorktree(repository, main)
67906786
}
67916787

67926788
try {
6793-
await removeWorktree(path, worktreePath, force)
6789+
await removeWorktree(repository.path, worktreePath, force)
67946790
} catch (e) {
67956791
this._closePopup(PopupType.DeleteWorktree)
67966792
this._closePopup(PopupType.DeleteWorktreeFailed)

0 commit comments

Comments
 (0)