Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion 7 .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"editor.formatOnSave": true,
"tslint.autoFixOnSave": true,
"[typescript]": {
"editor.detectIndentation": false,
"editor.autoIndent": false,
"editor.insertSpaces": true,
"editor.tabSize": 4,
"editor.wordWrap": "wordWrapColumn",
Expand All @@ -22,8 +22,12 @@
"Hamano",
"ISMTP",
"Junio",
"Nguy",
"Nguyễn",
"Ngọc",
"Probot",
"Schindelin",
"Thái",
"Truthy",
"VSTS",
"amlog",
Expand All @@ -47,6 +51,7 @@
"mergeable",
"octokit",
"onelines",
"pclouds",
"pobox",
"promisify",
"publishtoremote",
Expand Down
42 changes: 18 additions & 24 deletions 42 lib/ci-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class CIHelper {
await this.maybeUpdateMail2CommitMap();
if (!this.commit2mailNotes) {
this.commit2mailNotes = new GitNotes(this.mail2commit.workDir,
"refs/notes/commit-to-mail");
"refs/notes/commit-to-mail");
await this.commit2mailNotes.update();
}
const messageId = await
Expand All @@ -74,7 +74,7 @@ export class CIHelper {
return undefined;
}
await this.mail2commit.mail2CommitNotes.setString(messageId,
gitGitCommit, true);
gitGitCommit, true);
await this.commit2mailNotes.appendCommitNote(gitGitCommit, messageId);
}

Expand Down Expand Up @@ -112,7 +112,7 @@ export class CIHelper {

if (!this.testing && mailMeta.pullRequestURL) {
await this.github.annotateCommit(mailMeta.originalCommit,
upstreamCommit);
upstreamCommit);
}

return true;
Expand Down Expand Up @@ -231,12 +231,9 @@ export class CIHelper {

// Identify branch in gitster/git
let gitsterBranch: string | undefined =
await git([
"for-each-ref",
`--points-at=${tipCommitInGitGit}`,
"--format=%(refname)",
"refs/remotes/gitster/",
], { workDir: this.workDir });
await git(["for-each-ref", `--points-at=${tipCommitInGitGit}`,
"--format=%(refname)", "refs/remotes/gitster/"],
{ workDir: this.workDir });
if (gitsterBranch) {
const newline = gitsterBranch.indexOf("\n");
if (newline > 0) {
Expand Down Expand Up @@ -348,12 +345,10 @@ export class CIHelper {
public async identifyMergeCommit(upstreamBranch: string,
integratedCommit: string):
Promise<string | undefined> {
const revs = await git([
"rev-list",
"--ancestry-path",
"--parents",
`${integratedCommit}..upstream/${upstreamBranch}`,
], { workDir: this.workDir });
const revs =
await git(["rev-list", "--ancestry-path", "--parents",
`${integratedCommit}..upstream/${upstreamBranch}`],
{ workDir: this.workDir });
if (revs === "") {
return undefined;
}
Expand Down Expand Up @@ -431,12 +426,9 @@ export class CIHelper {
workDir: this.workDir,
});
}
const revs = await git([
"rev-list",
`${prMeta.baseCommit}..${prMeta.headCommit}`,
], {
workDir: this.workDir,
});
const revs = await git(["rev-list",
`${prMeta.baseCommit}..${prMeta.headCommit}`],
{ workDir: this.workDir });
return revs.split(/\s+/);
}

Expand Down Expand Up @@ -507,9 +499,11 @@ export class CIHelper {
comment.author}`);
}

const coverMid = await gitGitGadget.submit(comment.author,
fullAuthorName, pullRequestURL, description,
pr.baseLabel, pr.baseCommit, pr.headLabel, pr.headCommit);
const coverMid =
await gitGitGadget.submit(comment.author, fullAuthorName,
pullRequestURL, description,
pr.baseLabel, pr.baseCommit,
pr.headLabel, pr.headCommit);
await addComment(`Submitted as [${
coverMid}](https://public-inbox.org/git/${coverMid})`);
} else if (command === "/allow") {
Expand Down
8 changes: 3 additions & 5 deletions 8 lib/git-notes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,9 @@ export class GitNotes {
if (this.notesRef === "refs/notes/gitgitgadget" ||
this.notesRef === "refs/notes/commit-to-mail" ||
this.notesRef === "refs/notes/mail-to-commit") {
await git([
"fetch",
"https://github.com/gitgitgadget/git",
`+${this.notesRef}:${this.notesRef}`,
], { workDir: this.workDir });
await git(["fetch", "https://github.com/gitgitgadget/git",
`+${this.notesRef}:${this.notesRef}`],
{ workDir: this.workDir });
} else {
throw new Error(`Don't know how to update ${this.notesRef}`);
}
Expand Down
8 changes: 4 additions & 4 deletions 8 lib/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ stdout: ${result.stdout}
* @returns { string | undefined } the full SHA-1, or undefined
*/
export async function revParse(argument: string, workDir?: string) {
const result = await GitProcess.exec([
"rev-parse", "--verify", "-q", argument,
], workDir || ".");
const result = await GitProcess.exec(["rev-parse", "--verify", "-q",
argument],
workDir || ".");
return result.exitCode ? undefined : trimTrailingNewline(result.stdout);
}

Expand Down Expand Up @@ -83,7 +83,7 @@ export async function gitConfigForEach(key: string,
workDir?: string):
Promise<void> {
const result = await GitProcess.exec(["config", "--get-all", key],
workDir || ".");
workDir || ".");
result.stdout.split(/\r?\n/).map(callbackfn);
}

Expand Down
64 changes: 28 additions & 36 deletions 64 lib/gitgitgadget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,31 +46,27 @@ export class GitGitGadget {
}

// Always fetch the Git notes first thing
await git([
"fetch",
publishTagsAndNotesToRemote,
"--",
`+${GitNotes.defaultNotesRef}:${GitNotes.defaultNotesRef}`,
], { workDir });
await git(["fetch", publishTagsAndNotesToRemote, "--",
`+${GitNotes.defaultNotesRef}:${GitNotes.defaultNotesRef}`],
{ workDir });

const notes = new GitNotes(workDir);

const smtpUser = await gitConfig("gitgitgadget.smtpUser",
gitGitGadgetDir);
gitGitGadgetDir);
const smtpHost = await gitConfig("gitgitgadget.smtpHost",
gitGitGadgetDir);
gitGitGadgetDir);
const smtpPass = await gitConfig("gitgitgadget.smtpPass",
gitGitGadgetDir);
gitGitGadgetDir);
if (!smtpUser || !smtpHost || !smtpPass) {
throw new Error(`No SMTP settings configured`);
}

const [options, allowedUsers] = await GitGitGadget.readOptions(notes);

return new GitGitGadget(notes,
options, allowedUsers,
smtpUser, smtpHost, smtpPass,
publishTagsAndNotesToRemote);
return new GitGitGadget(notes, options, allowedUsers,
smtpUser, smtpHost, smtpPass,
publishTagsAndNotesToRemote);
}

public static parsePullRequestURL(pullRequestURL: string):
Expand Down Expand Up @@ -188,17 +184,19 @@ export class GitGitGadget {
`refs/tags/${metadata.latestTag}` : undefined;
await this.updateNotesAndPullRef(pullRequestNumber, previousTag);

const series = await PatchSeries.getFromNotes(this.notes,
pullRequestURL, description, baseLabel, baseCommit, headLabel,
headCommit, gitHubUserName);

const coverMid = await series.generateAndSend(console,
async (mail: string): Promise<string> => {
return await parseHeadersAndSendMail(mail, this.smtpOptions);
},
this.publishTagsAndNotesToRemote, pullRequestURL,
new Date(),
);
const series =
await PatchSeries.getFromNotes(this.notes, pullRequestURL,
description, baseLabel, baseCommit,
headLabel, headCommit,
gitHubUserName);

const send = async (mail: string): Promise<string> => {
return await parseHeadersAndSendMail(mail, this.smtpOptions);
};
const coverMid =
await series.generateAndSend(console, send,
this.publishTagsAndNotesToRemote,
pullRequestURL, new Date());
return coverMid;
}

Expand Down Expand Up @@ -234,23 +232,17 @@ export class GitGitGadget {
}

protected async fetchAndReReadOptions(): Promise<void> {
await git([
"fetch",
this.publishTagsAndNotesToRemote,
"--",
`+${GitNotes.defaultNotesRef}:${GitNotes.defaultNotesRef}`,
], { workDir: this.workDir });
await git(["fetch", this.publishTagsAndNotesToRemote, "--",
`+${GitNotes.defaultNotesRef}:${GitNotes.defaultNotesRef}`],
{ workDir: this.workDir });
[this.options, this.allowedUsers] =
await GitGitGadget.readOptions(this.notes);
}

protected async pushNotesRef(): Promise<void> {
await git([
"push",
this.publishTagsAndNotesToRemote,
"--",
`${this.notes.notesRef}`,
], { workDir: this.workDir });
await git(["push", this.publishTagsAndNotesToRemote, "--",
`${this.notes.notesRef}`],
{ workDir: this.workDir });

// re-read options
[this.options, this.allowedUsers] =
Expand Down
6 changes: 3 additions & 3 deletions 6 lib/github-glue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export class GitHubGlue {

public async annotateCommit(originalCommit: string, gitGitCommit: string):
Promise<number> {
const output = await git([
"show", "-s", "--format=%h %cI", gitGitCommit,
], { workDir: this.workDir });
const output =
await git(["show", "-s", "--format=%h %cI", gitGitCommit],
{ workDir: this.workDir });
const match = output.match(/^(\S+) (\S+)$/);
if (!match) {
throw new Error(`Could not find ${gitGitCommit}: '${output}'`);
Expand Down
9 changes: 3 additions & 6 deletions 9 lib/mail-commit-mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class MailCommitMapping {
public constructor(workDir?: string) {
this.workDir = workDir;
this.mail2CommitNotes = new GitNotes(workDir,
"refs/notes/mail-to-commit");
"refs/notes/mail-to-commit");
}

public async getGitGitCommitForMessageId(messageID: string):
Expand Down Expand Up @@ -40,11 +40,8 @@ export class MailCommitMapping {
refs.push("+refs/heads/*:refs/remotes/gitster/*");
}
if (refs.length) {
await git([
"fetch",
"https://github.com/gitgitgadget/git",
...refs,
], { workDir: this.workDir });
await git(["fetch", "https://github.com/gitgitgadget/git", ...refs],
{ workDir: this.workDir });
}
}
}
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.