Skip to content

Commit 39c86ed

Browse files
committed
ProjectOptions: 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 0398959 commit 39c86ed

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

lib/patch-series.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export class PatchSeries {
140140

141141
const publishToRemote: string | undefined = undefined;
142142

143-
const project = await ProjectOptions.get(workDir, headCommit, cc, basedOn, publishToRemote, baseCommit);
143+
const project = await ProjectOptions.get(config, workDir, headCommit, cc, basedOn, publishToRemote, baseCommit);
144144
if (rangeDiff) {
145145
options.rangeDiff = rangeDiff;
146146
}

lib/project-options.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { commitExists, git, revParse } from "./git.js";
2-
import { IConfig, getConfig, projectInfo } from "./project-config.js";
2+
import { IConfig, projectInfo } from "./project-config.js";
33

44
// For now, only the Git, Cygwin and BusyBox projects are supported
55
export class ProjectOptions {
66
public static async get(
7+
config: IConfig,
78
workDir: string,
89
branchName: string,
910
cc: string[],
1011
basedOn?: string,
1112
publishToRemote?: string,
1213
baseCommit?: string,
1314
): Promise<ProjectOptions> {
14-
const config: IConfig = getConfig();
1515
let upstreamBranch: string;
1616
let to: string;
1717
let midUrlPrefix = " Message-ID: ";

tests/project-options.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ test("project options", async () => {
2727
expect(await repo.commit("C")).not.toEqual("");
2828

2929
const options2 = await ProjectOptions.get(
30+
defaultConfig,
3031
repo.workDir,
3132
"test-project-options",
3233
["Nguyễn Thái Ngọc Duy <pclouds@gmail.com>"],

0 commit comments

Comments
 (0)