Skip to content

Commit e513fc7

Browse files
committed
mhutchie#452 Explicitly override the Git configuration variable log.showSignature to ensure consistent parsing of commits.
1 parent d7f0356 commit e513fc7

File tree

2 files changed

+36
-34
lines changed

2 files changed

+36
-34
lines changed

src/dataSource.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ export class DataSource extends Disposable {
456456
* @returns The subject string, or NULL if an error occurred.
457457
*/
458458
public getCommitSubject(repo: string, commitHash: string): Promise<string | null> {
459-
return this.spawnGit(['log', '--format=%s', '-n', '1', commitHash, '--'], repo, (stdout) => {
459+
return this.spawnGit(['-c', 'log.showSignature=false', 'log', '--format=%s', '-n', '1', commitHash, '--'], repo, (stdout) => {
460460
return stdout.trim().replace(/\s+/g, ' ');
461461
}).then((subject) => subject, () => null);
462462
}
@@ -1316,7 +1316,7 @@ export class DataSource extends Disposable {
13161316
* @returns The base commit details.
13171317
*/
13181318
private getCommitDetailsBase(repo: string, commitHash: string) {
1319-
return this.spawnGit(['show', '--quiet', commitHash, '--format=' + this.gitFormatCommitDetails], repo, (stdout): DeepWriteable<GitCommitDetails> => {
1319+
return this.spawnGit(['-c', 'log.showSignature=false', 'show', '--quiet', commitHash, '--format=' + this.gitFormatCommitDetails], repo, (stdout): DeepWriteable<GitCommitDetails> => {
13201320
const commitInfo = stdout.split(GIT_LOG_SEPARATOR);
13211321
return {
13221322
hash: commitInfo[0],
@@ -1448,8 +1448,10 @@ export class DataSource extends Disposable {
14481448
* @returns An array of commits.
14491449
*/
14501450
private getLog(repo: string, branches: ReadonlyArray<string> | null, num: number, includeTags: boolean, includeRemotes: boolean, includeCommitsMentionedByReflogs: boolean, onlyFollowFirstParent: boolean, order: CommitOrdering, remotes: ReadonlyArray<string>, hideRemotes: ReadonlyArray<string>, stashes: ReadonlyArray<GitStash>) {
1451-
let args = ['log', '--max-count=' + num, '--format=' + this.gitFormatLog, '--' + order + '-order'];
1452-
if (onlyFollowFirstParent) args.push('--first-parent');
1451+
const args = ['-c', 'log.showSignature=false', 'log', '--max-count=' + num, '--format=' + this.gitFormatLog, '--' + order + '-order'];
1452+
if (onlyFollowFirstParent) {
1453+
args.push('--first-parent');
1454+
}
14531455
if (branches !== null) {
14541456
for (let i = 0; i < branches.length; i++) {
14551457
args.push(branches[i]);

0 commit comments

Comments
 (0)