From d92e354763c95228ba7b16fcaa7c24fe7f1f19e7 Mon Sep 17 00:00:00 2001
From: Michael Kriese <michael.kriese@visualon.de>
Date: Mon, 17 Aug 2020 12:09:29 +0200
Subject: [PATCH] fix(git): rethrow empty repo error (#6998)

Co-authored-by: Jamie Magee <JamieMagee@users.noreply.github.com>
---
 lib/util/git/index.ts | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/util/git/index.ts b/lib/util/git/index.ts
index 4bd3fc639e..3dafd524c7 100644
--- a/lib/util/git/index.ts
+++ b/lib/util/git/index.ts
@@ -192,6 +192,9 @@ export async function syncGit(): Promise<void> {
       logger.debug({ durationMs }, 'git fetch completed');
       clone = false;
     } catch (err) /* istanbul ignore next */ {
+      if (err.message === REPOSITORY_EMPTY) {
+        throw err;
+      }
       logger.error({ err }, 'git fetch error');
     }
   }
@@ -213,6 +216,9 @@ export async function syncGit(): Promise<void> {
       if (err.message?.includes('No space left on device')) {
         throw new Error(SYSTEM_INSUFFICIENT_DISK_SPACE);
       }
+      if (err.message === REPOSITORY_EMPTY) {
+        throw err;
+      }
       throw new ExternalHostError(err, 'git');
     }
     const durationMs = Math.round(Date.now() - cloneStart);
-- 
GitLab