mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-04 15:25:47 +01:00
fix: commit changes in empty git repo before Continue Working On (#246637)
This commit is contained in:
@@ -82,9 +82,23 @@ export class GitEditSessionIdentityProvider implements vscode.EditSessionIdentit
|
||||
|
||||
await repository.status();
|
||||
|
||||
// If this branch hasn't been published to the remote yet,
|
||||
// ensure that it is published before Continue On is invoked
|
||||
if (!repository.HEAD?.upstream && repository.HEAD?.type === RefType.Head) {
|
||||
if (!repository.HEAD?.commit) {
|
||||
// Handle publishing empty repository with no commits
|
||||
|
||||
const yes = vscode.l10n.t('Yes');
|
||||
const selection = await vscode.window.showInformationMessage(
|
||||
vscode.l10n.t('Would you like to publish this repository to continue working on it elsewhere?'),
|
||||
{ modal: true },
|
||||
yes
|
||||
);
|
||||
if (selection !== yes) {
|
||||
throw new vscode.CancellationError();
|
||||
}
|
||||
await repository.commit('Initial commit', { all: true });
|
||||
await vscode.commands.executeCommand('git.publish');
|
||||
} else if (!repository.HEAD?.upstream && repository.HEAD?.type === RefType.Head) {
|
||||
// If this branch hasn't been published to the remote yet,
|
||||
// ensure that it is published before Continue On is invoked
|
||||
|
||||
const publishBranch = vscode.l10n.t('Publish Branch');
|
||||
const selection = await vscode.window.showInformationMessage(
|
||||
|
||||
Reference in New Issue
Block a user