clean up dialog and add additional warning (#263908)

* restrict dialog to less than 5 files

* add warning dialog
This commit is contained in:
Christy 😺
2025-08-28 15:34:27 -07:00
committed by GitHub
parent ae8e5fde7c
commit 9c9a837573

View File

@@ -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();