This commit is contained in:
Joao Moreno 2018-12-06 09:43:12 +01:00
parent d0c114cd68
commit 351905fd53

View file

@ -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?");