Skip to content

Commit 0398959

Browse files
committed
MailCommitMapping: do not allow the config to be passed implicitly
Implicit configuration is a recipe for confusion when trying to allow for overriding said configuration. Let's require the config to be passed down explicitly. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 5186451 commit 0398959

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/ci-helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class CIHelper {
5959
this.workDir = workDir;
6060
this.notes = new GitNotes(workDir);
6161
this.gggNotesUpdated = !!skipUpdate;
62-
this.mail2commit = new MailCommitMapping(this.notes.workDir);
62+
this.mail2commit = new MailCommitMapping(this.config, this.notes.workDir);
6363
this.mail2CommitMapUpdated = !!skipUpdate;
6464
this.github = new GitHubGlue(workDir, this.config.repo.owner, this.config.repo.name);
6565
this.testing = false;

lib/mail-commit-mapping.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { git } from "./git.js";
22
import { GitNotes } from "./git-notes.js";
3-
import { IConfig, getConfig } from "./project-config.js";
3+
import { IConfig } from "./project-config.js";
44

55
export class MailCommitMapping {
6-
public readonly config: IConfig = getConfig();
6+
public readonly config: IConfig;
77
public readonly workDir?: string;
88
public readonly mail2CommitNotes: GitNotes;
99

10-
public constructor(workDir?: string) {
10+
public constructor(config: IConfig, workDir?: string) {
11+
this.config = config;
1112
this.workDir = workDir;
1213
this.mail2CommitNotes = new GitNotes(workDir, "refs/notes/mail-to-commit");
1314
}

0 commit comments

Comments
 (0)