Change the repository creation method
This commit is contained in:
@@ -1,19 +1,28 @@
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { GitExtension } from './git';
|
import { GitExtension } from './git';
|
||||||
|
|
||||||
export function activate() {
|
export async function activate() {
|
||||||
var conf = vscode.workspace.getConfiguration("gitcheck");
|
var conf = vscode.workspace.getConfiguration("gitcheck");
|
||||||
const domain = conf.get<string>("domain");
|
const domain = conf.get<string>("domain");
|
||||||
const user = conf.get<string>("user");
|
const user = conf.get<string>("user");
|
||||||
const email = conf.get<string>("email");
|
const email = conf.get<string>("email");
|
||||||
|
|
||||||
|
if (!vscode.workspace.workspaceFolders) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(domain && user && email)) {
|
if (!(domain && user && email)) {
|
||||||
console.log("Missing config params");
|
console.log("Missing config params");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const git = vscode.extensions.getExtension<GitExtension>('vscode.git')!.exports.getAPI(1)!;
|
const git = vscode.extensions.getExtension<GitExtension>('vscode.git')!.exports.getAPI(1)!;
|
||||||
const repository = git.repositories[0];
|
const repository = await git.openRepository(vscode.workspace.workspaceFolders[0].uri);
|
||||||
|
|
||||||
|
if (!repository) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
repository.state.remotes.forEach(async remote => {
|
repository.state.remotes.forEach(async remote => {
|
||||||
const pushUrl = remote.pushUrl;
|
const pushUrl = remote.pushUrl;
|
||||||
if (pushUrl && pushUrl.includes(domain)) {
|
if (pushUrl && pushUrl.includes(domain)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user