Skip to content

Commit

Permalink
fix: checkRequirements cant find user.name/email
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinzent03 committed Aug 19, 2021
1 parent 5e07e80 commit 1994a44
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/gitManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export abstract class GitManager {

abstract canPush(): Promise<boolean>;

abstract checkRequirements(): Promise<"valid" | "missing-repo" | "wrong-settings" | "missing-git">;
abstract checkRequirements(): Promise<"valid" | "missing-repo" | "missing-git">;

abstract branchInfo(): Promise<BranchInfo>;

Expand Down
11 changes: 1 addition & 10 deletions src/simpleGit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,22 +97,13 @@ export class SimpleGit extends GitManager {
return remoteChangedFiles !== 0;
}

async checkRequirements(): Promise<"valid" | "missing-repo" | "missing-git" | "wrong-settings"> {
async checkRequirements(): Promise<"valid" | "missing-repo" | "missing-git"> {
if (!this.isGitInstalled()) {
return "missing-git";
}
if (!(await this.git.checkIsRepo())) {
return "missing-repo";
}
const config = (await this.git.listConfig((err: any) => this.onError(err))).all;
const user = config["user.name"];
const email = config["user.email"];
const remoteURL = config["remote.origin.url"];

if (!user || !email || !remoteURL) {
return "wrong-settings";
}

return "valid";
}

Expand Down

0 comments on commit 1994a44

Please sign in to comment.