Compare commits

..

4 Commits

Author SHA1 Message Date
1f542367e6 1.0.12 2019-08-27 16:02:04 +02:00
201a5014ed fix(core): update 2019-08-27 16:02:04 +02:00
6cc245ae7e 1.0.11 2019-06-20 14:19:54 +02:00
1377fb6eb7 fix(core): update 2019-06-20 14:19:54 +02:00
3 changed files with 207 additions and 232 deletions

401
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartgit",
"version": "1.0.10",
"version": "1.0.12",
"description": "smart wrapper for nodegit",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
@ -24,20 +24,20 @@
},
"homepage": "https://gitlab.com/pushrocks/smartgit",
"dependencies": {
"@pushrocks/smartfile": "^7.0.2",
"@pushrocks/smartfile": "^7.0.4",
"@pushrocks/smartpath": "^4.0.1",
"@pushrocks/smartpromise": "^3.0.2",
"@pushrocks/smartshell": "^2.0.23",
"@pushrocks/smartstring": "^3.0.10",
"@types/minimatch": "^3.0.3",
"@types/nodegit": "^0.24.8",
"nodegit": "^0.24.3"
"@types/nodegit": "^0.24.10",
"nodegit": "^0.25.1"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.11",
"@gitzone/tsbuild": "^2.1.17",
"@gitzone/tstest": "^1.0.24",
"@pushrocks/tapbundle": "^3.0.9",
"tslint": "^5.17.0",
"@pushrocks/tapbundle": "^3.0.13",
"tslint": "^5.19.0",
"tslint-config-prettier": "^1.18.0"
},
"private": false,

View File

@ -43,12 +43,32 @@ export class GitRepo {
return this.nodegitRepo.getRemotes();
}
/**
* ensures the existance of a remote within a repository
* @param remoteNameArg
* @param remoteUrlArg
*/
public async ensureRemote(remoteNameArg: string, remoteUrlArg: string): Promise<void> {
const existingUrl = await this.getUrlForRemote(remoteNameArg);
if (existingUrl === remoteUrlArg) {
return;
}
if (existingUrl) {
await plugins.nodegit.Remote.delete(this.nodegitRepo, remoteNameArg);
}
await plugins.nodegit.Remote.create(this.nodegitRepo, remoteNameArg, remoteUrlArg);
}
/**
* gets the url for a specific remote
*/
public async getUrlForRemote(remoteName: string) {
public async getUrlForRemote(remoteName: string): Promise<string> {
const ngRemote = await this.nodegitRepo.getRemote(remoteName);
return ngRemote.url;
if (ngRemote) {
return ngRemote.url();
} else {
return null;
}
}
public async pushBranchToRemote(branchName: string, remoteName: string) {