Skip to content

Commit 1bad447

Browse files
committed
IConfig: rename the attribute defining the upstream-repo's org
We've settled on the nomenclature `upstream-repo` to refer to the original repository of the project, as opposed to the `pr-repo` which is a fork that exists exclusively to let GitGitGadget handle PRs in (and to store its global state in the Git notes). So let's call the owner of the `upstream-repo` the `upstreamOwner`, not the `baseOwner`. Besides, with GitHub's naming conventions referring to the branch a PR targets as the "base", it is a bit confusing to have `baseOwner` to refer to anything except the owner of the repository in which the PR lives. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 78c6c3c commit 1bad447

5 files changed

Lines changed: 11 additions & 11 deletions

File tree

lib/ci-helper.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export class CIHelper {
101101

102102
// get the access tokens via the inputs of the GitHub Action
103103
this.setAccessToken(this.config.repo.owner, core.getInput("pr-repo-token"));
104-
this.setAccessToken(this.config.repo.baseOwner, core.getInput("upstream-repo-token"));
104+
this.setAccessToken(this.config.repo.upstreamOwner, core.getInput("upstream-repo-token"));
105105
if (this.config.repo.testOwner) {
106106
this.setAccessToken(this.config.repo.testOwner, core.getInput("test-repo-token"));
107107
}
@@ -128,7 +128,7 @@ export class CIHelper {
128128
["remote.origin.url", `https://github.com/${this.config.repo.owner}/${this.config.repo.name}`],
129129
["remote.origin.promisor", "true"],
130130
["remote.origin.partialCloneFilter", "blob:none"],
131-
["remote.upstream.url", `https://github.com/${this.config.repo.baseOwner}/${this.config.repo.name}`],
131+
["remote.upstream.url", `https://github.com/${this.config.repo.upstreamOwner}/${this.config.repo.name}`],
132132
["remote.upstream.promisor", "true"],
133133
["remote.upstream.partialCloneFilter", "blob:none"],
134134
]) {
@@ -411,7 +411,7 @@ export class CIHelper {
411411
mailMeta.originalCommit,
412412
upstreamCommit,
413413
this.config.repo.owner,
414-
this.config.repo.baseOwner,
414+
this.config.repo.upstreamOwner,
415415
);
416416
}
417417

@@ -654,7 +654,7 @@ export class CIHelper {
654654

655655
// Add comment on GitHub
656656
const comment = `This patch series was integrated into ${branch} via https://github.com/${
657-
this.config.repo.baseOwner
657+
this.config.repo.upstreamOwner
658658
}/${this.config.repo.name}/commit/${mergeCommit}.`;
659659
const url = await this.github.addPRComment(prKey, comment);
660660
console.log(`Added comment ${url.id} about ${branch}: ${url.url}`);

lib/gitgitgadget-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const defaultConfig: IConfig = {
44
repo: {
55
name: "git",
66
owner: "gitgitgadget",
7-
baseOwner: "git",
7+
upstreamOwner: "git",
88
testOwner: "dscho",
99
owners: ["gitgitgadget", "git", "dscho"],
1010
branches: ["maint", "seen"],

lib/project-config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface IConfig {
1212
repo: {
1313
name: string; // name of the repo
1414
owner: string; // owner of repo holding the notes (tracking data)
15-
baseOwner: string; // owner of upstream ("base") repo
15+
upstreamOwner: string; // owner of upstream ("base") repo
1616
testOwner?: string; // owner of the test repo (if any)
1717
owners: string[]; // owners of clones being monitored (PR checking)
1818
branches: string[]; // remote branches to fetch - just use trackingBranches?
@@ -88,8 +88,8 @@ export async function getExternalConfig(file: string): Promise<IConfig> {
8888
throw new Error(`Invalid 'owner' ${newConfig.repo.owner} in ${filePath}`);
8989
}
9090

91-
if (!newConfig.repo.baseOwner.match(/^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}$/i)) {
92-
throw new Error(`Invalid 'baseOwner' ${newConfig.repo.baseOwner} in ${filePath}`);
91+
if (!newConfig.repo.upstreamOwner.match(/^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}$/i)) {
92+
throw new Error(`Invalid 'upstreamOwner' ${newConfig.repo.upstreamOwner} in ${filePath}`);
9393
}
9494

9595
return newConfig;

script/misc-helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ const commandOptions = commander.opts<ICommanderOptions>();
200200
originalCommit,
201201
gitGitCommit,
202202
config.repo.owner,
203-
config.repo.baseOwner,
203+
config.repo.upstreamOwner,
204204
);
205205
console.log(`Created check with id ${id}`);
206206
});

tests-config/ci-helper.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const testConfig: IConfig = {
1616
repo: {
1717
name: "telescope",
1818
owner: "webb",
19-
baseOwner: "galileo",
19+
upstreamOwner: "galileo",
2020
owners: ["webb", "galileo"],
2121
branches: ["maint"],
2222
closingBranches: ["maint", "main"],
@@ -172,7 +172,7 @@ async function setupRepos(instance: string):
172172
await gggLocal.git([ "config", `url.${gggRemote.workDir}.insteadOf`, url ]);
173173
// pretend there are two remotes
174174
await gggLocal.git([ "config", `url.${gggRemote.workDir}.insteadOf`,
175-
`https://github.com/${config.repo.baseOwner}/${config.repo.name}` ]);
175+
`https://github.com/${config.repo.upstreamOwner}/${config.repo.name}` ]);
176176

177177
// set needed config
178178
await worktree.git([ "config", "--add", "gitgitgadget.workDir", gggLocal.workDir, ]);

0 commit comments

Comments
 (0)