Read-only mirror — the public repositories of the Forgejo instance, refreshed every 10 minutes. The live instance (fg.dieschoenewolke.de) is reachable only over the VPN; clone here with https://git.dieschoenewolke.de/git/<owner>/<repo>.git.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Boop <52323235+thboop@users.noreply.github.com>2020-09-23 09:41:47 -0400
committerGitHub <noreply@github.com>2020-09-23 09:41:47 -0400
commit6943eced8faa00b363a577a3e573551e2255efac (patch)
tree4b1d350c4cd428896ead4534cb625044b9e89d0d
parent0e68cab139db160d6e9937a23b4cbb50fa4b3627 (diff)
Remove unneeded commit information from build logs (#345)v2.3.3
* Remove unneeded commit information from stdout
-rw-r--r--dist/index.js13
-rw-r--r--src/git-command-manager.ts12
-rw-r--r--src/git-source-provider.ts5
3 files changed, 21 insertions, 9 deletions
diff --git a/dist/index.js b/dist/index.js
index ae64f3f..9683c11 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -5883,9 +5883,11 @@ class GitCommandManager {
yield this.execGit(['lfs', 'install', '--local']);
});
}
- log1() {
+ log1(format) {
return __awaiter(this, void 0, void 0, function* () {
- const output = yield this.execGit(['log', '-1']);
+ var args = format ? ['log', '-1', format] : ['log', '-1'];
+ var silent = format ? false : true;
+ const output = yield this.execGit(args, false, silent);
return output.stdout;
});
}
@@ -6007,7 +6009,7 @@ class GitCommandManager {
return result;
});
}
- execGit(args, allowAllExitCodes = false) {
+ execGit(args, allowAllExitCodes = false, silent = false) {
return __awaiter(this, void 0, void 0, function* () {
fshelper.directoryExistsSync(this.workingDirectory, true);
const result = new GitOutput();
@@ -6022,6 +6024,7 @@ class GitCommandManager {
const options = {
cwd: this.workingDirectory,
env,
+ silent,
ignoreReturnCode: allowAllExitCodes,
listeners: {
stdout: (data) => {
@@ -6267,8 +6270,10 @@ function getSource(settings) {
yield authHelper.removeGlobalAuth();
}
}
- // Dump some info about the checked out commit
+ // Get commit information
const commitInfo = yield git.log1();
+ // Log commit sha
+ yield git.log1("--format='%H'");
// Check for incorrect pull request merge commit
yield refHelper.checkCommitInfo(settings.authToken, commitInfo, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.commit);
}
diff --git a/src/git-command-manager.ts b/src/git-command-manager.ts
index 059e3d8..409a161 100644
--- a/src/git-command-manager.ts
+++ b/src/git-command-manager.ts
@@ -31,7 +31,7 @@ export interface IGitCommandManager {
isDetached(): Promise<boolean>
lfsFetch(ref: string): Promise<void>
lfsInstall(): Promise<void>
- log1(): Promise<string>
+ log1(format?: string): Promise<string>
remoteAdd(remoteName: string, remoteUrl: string): Promise<void>
removeEnvironmentVariable(name: string): void
revParse(ref: string): Promise<string>
@@ -254,8 +254,10 @@ class GitCommandManager {
await this.execGit(['lfs', 'install', '--local'])
}
- async log1(): Promise<string> {
- const output = await this.execGit(['log', '-1'])
+ async log1(format?: string): Promise<string> {
+ var args = format ? ['log', '-1', format] : ['log', '-1']
+ var silent = format ? false : true
+ const output = await this.execGit(args, false, silent)
return output.stdout
}
@@ -390,7 +392,8 @@ class GitCommandManager {
private async execGit(
args: string[],
- allowAllExitCodes = false
+ allowAllExitCodes = false,
+ silent = false
): Promise<GitOutput> {
fshelper.directoryExistsSync(this.workingDirectory, true)
@@ -409,6 +412,7 @@ class GitCommandManager {
const options = {
cwd: this.workingDirectory,
env,
+ silent,
ignoreReturnCode: allowAllExitCodes,
listeners: {
stdout: (data: Buffer) => {
diff --git a/src/git-source-provider.ts b/src/git-source-provider.ts
index 366ff33..42a12e0 100644
--- a/src/git-source-provider.ts
+++ b/src/git-source-provider.ts
@@ -201,9 +201,12 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
}
}
- // Dump some info about the checked out commit
+ // Get commit information
const commitInfo = await git.log1()
+ // Log commit sha
+ await git.log1("--format='%H'")
+
// Check for incorrect pull request merge commit
await refHelper.checkCommitInfo(
settings.authToken,