diff --git a/dist/index.js b/dist/index.js index 7f8c7d7..ba1f70e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5883,9 +5883,10 @@ 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'], false, true); + var args = format ? ['log', '-1', format] : ['log', '-1']; + const output = yield this.execGit(args, false, true); return output.stdout; }); } @@ -6268,8 +6269,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 bbfd870..cc2efde 100644 --- a/src/git-command-manager.ts +++ b/src/git-command-manager.ts @@ -31,7 +31,7 @@ export interface IGitCommandManager { isDetached(): Promise lfsFetch(ref: string): Promise lfsInstall(): Promise - log1(): Promise + log1(format?: string): Promise remoteAdd(remoteName: string, remoteUrl: string): Promise removeEnvironmentVariable(name: string): void revParse(ref: string): Promise @@ -254,8 +254,9 @@ class GitCommandManager { await this.execGit(['lfs', 'install', '--local']) } - async log1(): Promise { - const output = await this.execGit(['log', '-1'], false, true) + async log1(format?: string): Promise { + var args = format ? ['log', '-1', format] : ['log', '-1'] + const output = await this.execGit(args, false, true) return output.stdout } diff --git a/src/git-source-provider.ts b/src/git-source-provider.ts index 366ff33..000a3ac 100644 --- a/src/git-source-provider.ts +++ b/src/git-source-provider.ts @@ -201,8 +201,11 @@ export async function getSource(settings: IGitSourceSettings): Promise { } } - // Dump some info about the checked out commit - const commitInfo = await git.log1() + // 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(