From 999f4fe63ccc18ff89d96fec20d904eba3bed7c1 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Sat, 31 Oct 2020 16:25:09 -0400 Subject: [PATCH] Allow empty (non-merge) commits --- src/git/parsers/logParser.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/git/parsers/logParser.ts b/src/git/parsers/logParser.ts index f4a4446..bed6485 100644 --- a/src/git/parsers/logParser.ts +++ b/src/git/parsers/logParser.ts @@ -189,16 +189,23 @@ export class GitLogParser { // 'f': // files // Skip the blank line git adds before the files next = lines.next(); + + let hasFiles = true; 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--; + // If this is a merge commit and there are no files returned, skip the commit and reduce our truncationCount to ensure accurate truncation detection + if ((entry.parentShas?.length ?? 0) > 1) { + if (truncationCount) { + truncationCount--; + } + + break; } - break; + hasFiles = false; } - while (true) { + // eslint-disable-next-line no-unmodified-loop-condition + while (hasFiles) { next = lines.next(); if (next.done) break;