git: init

This commit is contained in:
Joao Moreno
2017-08-23 16:12:46 +02:00
parent df2143f533
commit bcf2f1dabb
3 changed files with 26 additions and 12 deletions

View File

@@ -311,8 +311,23 @@ export class CommandCenter {
@command('git.init')
async init(): Promise<void> {
// TODO@joao
// await model.init();
const value = workspace.workspaceFolders && workspace.workspaceFolders.length > 0
? workspace.workspaceFolders[0].uri.fsPath
: os.homedir();
const path = await window.showInputBox({
placeHolder: localize('path to init', "Folder path"),
prompt: localize('provide path', "Please provide a folder path to initialize a Git repository"),
value,
ignoreFocusOut: true
});
if (!path) {
return;
}
await this.git.init(path);
await this.model.tryOpenRepository(path);
}
@command('git.openFile')

View File

@@ -84,7 +84,7 @@ export class Model {
}
@sequentialize
private async tryOpenRepository(path: string): Promise<void> {
async tryOpenRepository(path: string): Promise<void> {
const repository = this.getRepository(path);
if (repository) {

View File

@@ -201,15 +201,14 @@ export enum Operation {
Pull = 1 << 9,
Push = 1 << 10,
Sync = 1 << 11,
Init = 1 << 12,
Show = 1 << 13,
Stage = 1 << 14,
GetCommitTemplate = 1 << 15,
DeleteBranch = 1 << 16,
Merge = 1 << 17,
Ignore = 1 << 18,
Tag = 1 << 19,
Stash = 1 << 20
Show = 1 << 12,
Stage = 1 << 13,
GetCommitTemplate = 1 << 14,
DeleteBranch = 1 << 15,
Merge = 1 << 16,
Ignore = 1 << 17,
Tag = 1 << 18,
Stash = 1 << 19
}
// function getOperationName(operation: Operation): string {