mirror of
https://github.com/Microsoft/vscode
synced 2024-09-19 10:40:41 +00:00
fixes #63957
This commit is contained in:
parent
d0c114cd68
commit
351905fd53
|
@ -496,6 +496,7 @@ export class CommandCenter {
|
|||
@command('git.init')
|
||||
async init(): Promise<void> {
|
||||
let repositoryPath: string | undefined = undefined;
|
||||
let askToOpen = true;
|
||||
|
||||
if (workspace.workspaceFolders) {
|
||||
const placeHolder = localize('init', "Pick workspace folder to initialize git repo in");
|
||||
|
@ -510,6 +511,7 @@ export class CommandCenter {
|
|||
return;
|
||||
} else if (item.folder) {
|
||||
repositoryPath = item.folder.uri.fsPath;
|
||||
askToOpen = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -543,6 +545,10 @@ export class CommandCenter {
|
|||
}
|
||||
|
||||
repositoryPath = uri.fsPath;
|
||||
|
||||
if (workspace.workspaceFolders && workspace.workspaceFolders.some(w => w.uri.toString() === uri.toString())) {
|
||||
askToOpen = false;
|
||||
}
|
||||
}
|
||||
|
||||
await this.git.init(repositoryPath);
|
||||
|
@ -552,6 +558,10 @@ export class CommandCenter {
|
|||
const open = localize('openrepo', "Open Repository");
|
||||
choices.push(open);
|
||||
|
||||
if (!askToOpen) {
|
||||
return;
|
||||
}
|
||||
|
||||
const addToWorkspace = localize('add', "Add to Workspace");
|
||||
if (workspace.workspaceFolders) {
|
||||
message = localize('proposeopen2 init', "Would you like to open the initialized repository, or add it to the current workspace?");
|
||||
|
|
Loading…
Reference in a new issue