mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-28 21:55:54 +00:00
git: init
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user