Skip to content

Commit ed9f03c

Browse files
Error handle delete worktree within a worktree (microsoft#258297)
1 parent afd1c83 commit ed9f03c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

extensions/git/src/commands.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3589,14 +3589,15 @@ export class CommandCenter {
35893589
return;
35903590
}
35913591

3592-
@command('git.deleteWorktree', { repository: true })
3592+
@command('git.deleteWorktree', { repository: true, repositoryFilter: ['worktree'] })
35933593
async deleteWorktree(repository: Repository): Promise<void> {
35943594
if (!repository.dotGit.commonPath) {
35953595
return;
35963596
}
35973597

35983598
const mainRepository = this.model.getRepository(path.dirname(repository.dotGit.commonPath));
35993599
if (!mainRepository) {
3600+
await window.showErrorMessage(l10n.t('You cannot delete the worktree you are currently in. Please switch to the main repository first.'), { modal: true });
36003601
return;
36013602
}
36023603

0 commit comments

Comments
 (0)