Skip to content

Commit 2e9e3b1

Browse files
committed
fix: better error message for missing author
1 parent f807d8a commit 2e9e3b1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/isomorphicGit.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ export class IsomorphicGit extends GitManager {
197197

198198
async commit(message: string): Promise<undefined> {
199199
try {
200+
await this.checkAuthorInfo();
200201
this.plugin.setState(PluginState.commit);
201202
const formatMessage = await this.formatCommitMessage(message);
202203
const hadConflict =
@@ -413,6 +414,8 @@ export class IsomorphicGit extends GitManager {
413414
await this.fetch();
414415
const branchInfo = await this.branchInfo();
415416

417+
await this.checkAuthorInfo();
418+
416419
const mergeRes = await this.wrapFS(
417420
git.merge({
418421
...this.getRepo(),
@@ -1033,6 +1036,14 @@ export class IsomorphicGit extends GitManager {
10331036
};
10341037
}
10351038

1039+
private async checkAuthorInfo(): Promise<void> {
1040+
const name = await this.getConfig("user.name");
1041+
const email = await this.getConfig("user.email");
1042+
if (!name || !email) {
1043+
throw "Git author information is not set. Please set it in the settings.";
1044+
}
1045+
}
1046+
10361047
private showNotice(message: string, infinity = true): Notice | undefined {
10371048
if (!this.plugin.settings.disablePopups) {
10381049
return new Notice(

0 commit comments

Comments
 (0)