From fa9adfabb1fd18f28e9092ac7329ee9d394a4f5a Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Fri, 8 May 2020 14:28:14 +0200
Subject: [PATCH] fix(git): gracefully handle clone disk space error

---
 lib/platform/git/storage.ts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/platform/git/storage.ts b/lib/platform/git/storage.ts
index 00bf651fb4..aa1d0b67d5 100644
--- a/lib/platform/git/storage.ts
+++ b/lib/platform/git/storage.ts
@@ -8,6 +8,7 @@ import {
   REPOSITORY_CHANGED,
   REPOSITORY_EMPTY,
   REPOSITORY_TEMPORARY_ERROR,
+  SYSTEM_INSUFFICIENT_DISK_SPACE,
 } from '../../constants/error-messages';
 import { logger } from '../../logger';
 import * as limits from '../../workers/global/limits';
@@ -168,6 +169,9 @@ export class Storage {
         await this._git.clone(config.url, '.', opts);
       } catch (err) /* istanbul ignore next */ {
         logger.debug({ err }, 'git clone error');
+        if (err.message?.includes('write error: No space left on device')) {
+          throw new Error(SYSTEM_INSUFFICIENT_DISK_SPACE);
+        }
         throw new Error(PLATFORM_FAILURE);
       }
       const durationMs = Math.round(Date.now() - cloneStart);
-- 
GitLab