From 9c9a83757350e46a26fa0a46c0e799674b54c0cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christy=20=F0=9F=98=BA?= Date: Thu, 28 Aug 2025 15:34:27 -0700 Subject: [PATCH] clean up dialog and add additional warning (#263908) * restrict dialog to less than 5 files * add warning dialog --- extensions/git/src/commands.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index 1039e021ac5..3dd210dfcf2 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -3451,12 +3451,26 @@ export class CommandCenter { // Check for 'LocalChangesOverwritten' error if (conflicts.length > 0) { - const fileList = conflicts.join('\n '); + const maxFilesShown = 5; + const filesToShow = conflicts.slice(0, maxFilesShown); + const remainingCount = conflicts.length - maxFilesShown; + + const fileList = filesToShow.join('\n ') + + (remainingCount > 0 ? l10n.t('\n and {0} more file{1}...', remainingCount, remainingCount > 1 ? 's' : '') : ''); + const message = l10n.t('Your local changes to the following files would be overwritten by merge:\n {0}\n\nPlease stage, commit, or stash your changes in the repository before migrating changes.', fileList); await window.showErrorMessage(message, { modal: true }); 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; + } + await worktreeRepository.createStash(undefined, true); const stashes = await worktreeRepository.getStashes();