diff --git a/src/git/git.ts b/src/git/git.ts index 79631af..6d678fd 100644 --- a/src/git/git.ts +++ b/src/git/git.ts @@ -724,13 +724,14 @@ export namespace Git { `--format=${GitLogParser.defaultFormat}`, '--full-history', `-M${similarityThreshold == null ? '' : `${similarityThreshold}%`}`, + '-m', ]; if (limit && !reverse) { params.push(`-n${limit}`); } - if (merges) { - params.push('-m'); + if (!merges) { + params.push('--first-parent'); } if (authors) { diff --git a/src/git/parsers/logParser.ts b/src/git/parsers/logParser.ts index 772c23c..65fe107 100644 --- a/src/git/parsers/logParser.ts +++ b/src/git/parsers/logParser.ts @@ -178,7 +178,14 @@ export class GitLogParser { // 'f': // files // Skip the blank line git adds before the files next = lines.next(); - if (next.done || next.value === '') break; + if (next.done || next.value === '') { + // If there are no files returned, we end up skipping the commit, so reduce our truncationCount to ensure accurate truncation detection + if (truncationCount) { + truncationCount--; + } + + break; + } while (true) { next = lines.next();