From e9c8367032da8f23e072015a8561efa099c299e7 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Fri, 12 Apr 2019 10:18:10 +0200 Subject: [PATCH] fix(gitFs): detect empty when checking latest commit --- lib/platform/git/storage.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/platform/git/storage.js b/lib/platform/git/storage.js index 308b3fa41c..15ee947aec 100644 --- a/lib/platform/git/storage.js +++ b/lib/platform/git/storage.js @@ -117,6 +117,9 @@ class Storage { const latestCommitDate = (await git.log({ n: 1 })).latest.date; logger.debug({ latestCommitDate }, 'latest commit'); } catch (err) /* istanbul ignore next */ { + if (err.message.includes('does not have any commits yet')) { + throw new Error('empty'); + } logger.warn({ err }, 'Cannot retrieve latest commit date'); } -- GitLab