Skip to content

Commit 5675a34

Browse files
committed
GitGitGadget: be intentional about the push URL in addition to the token
In gitgitgadget/gitgitgadget#1974, I changed the way the push token is handed down from CIHelper to GitGitGadget instead of relying on the Git config (or environment) to specify it implicitly. Let's do the same for the URL of the repository to which to push the Git notes and patch series iterations' tags. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 2c07b12 commit 5675a34

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

lib/ci-helper.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,12 @@ export class CIHelper {
582582
};
583583

584584
try {
585-
const gitGitGadget = await GitGitGadget.get(this.gggConfigDir, this.workDir, this.notesPushToken);
585+
const gitGitGadget = await GitGitGadget.get(
586+
this.gggConfigDir,
587+
this.workDir,
588+
this.urlRepo,
589+
this.notesPushToken,
590+
);
586591
if (!gitGitGadget.isUserAllowed(comment.author)) {
587592
throw new Error(`User ${comment.author} is not yet permitted to use ${this.config.app.displayName}`);
588593
}
@@ -788,7 +793,7 @@ export class CIHelper {
788793
await this.github.addPRComment(prKey, redacted);
789794
};
790795

791-
const gitGitGadget = await GitGitGadget.get(this.gggConfigDir, this.workDir, this.notesPushToken);
796+
const gitGitGadget = await GitGitGadget.get(this.gggConfigDir, this.workDir, this.urlRepo, this.notesPushToken);
792797
if (!pr.hasComments && !gitGitGadget.isUserAllowed(pr.author)) {
793798
const welcome = (await readFile("res/WELCOME.md")).toString().replace(/\${username}/g, pr.author);
794799
await this.github.addPRComment(prKey, welcome);

lib/gitgitgadget.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,17 @@ export class GitGitGadget {
3636
return workDir;
3737
}
3838

39-
public static async get(gitGitGadgetDir: string, workDir?: string, notesPushToken?: string): Promise<GitGitGadget> {
39+
public static async get(
40+
gitGitGadgetDir: string,
41+
workDir?: string,
42+
publishTagsAndNotesToRemote?: string,
43+
notesPushToken?: string,
44+
): Promise<GitGitGadget> {
4045
if (!workDir) {
4146
workDir = await this.getWorkDir(gitGitGadgetDir);
4247
}
4348

44-
const publishTagsAndNotesToRemote = await getVar("publishRemote", gitGitGadgetDir);
49+
if (!publishTagsAndNotesToRemote) publishTagsAndNotesToRemote = await getVar("publishRemote", gitGitGadgetDir);
4550
if (!publishTagsAndNotesToRemote) {
4651
throw new Error("No remote to which to push configured");
4752
}

0 commit comments

Comments
 (0)