diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index 824798dc0c5..257943ed331 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -3462,12 +3462,15 @@ export class CommandCenter { return; } - const message = l10n.t('Proceed with migrating changes to the current repository?'); - const detail = l10n.t('This will apply the worktree\'s changes to this repository and discard changes in the worktree.\nThis is IRREVERSIBLE!'); - const proceed = l10n.t('Proceed'); - const pick = await window.showWarningMessage(message, { modal: true, detail }, proceed); - if (pick !== proceed) { - return; + if (worktreeUri === undefined) { + // Non-interactive migration, do not show confirmation dialog + const message = l10n.t('Proceed with migrating changes to the current repository?'); + const detail = l10n.t('This will apply the worktree\'s changes to this repository and discard changes in the worktree.\nThis is IRREVERSIBLE!'); + const proceed = l10n.t('Proceed'); + const pick = await window.showWarningMessage(message, { modal: true, detail }, proceed); + if (pick !== proceed) { + return; + } } await worktreeRepository.createStash(undefined, true);