From bd1179397b4828a0de577d53bc6549bc48407127 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Sat, 18 Jan 2020 11:55:32 +0100
Subject: [PATCH] fix: skip empty commits (#5184)

Skips the git commit force push if git returns no diff between the local branch and server branch of the same name.

Closes #5009, Closes #5083, Closes #5074
---
 lib/platform/git/storage.ts | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/platform/git/storage.ts b/lib/platform/git/storage.ts
index 1dcdcf5cde..0ada735638 100644
--- a/lib/platform/git/storage.ts
+++ b/lib/platform/git/storage.ts
@@ -528,10 +528,11 @@ export class Storage {
       }
       await this._git!.commit(message);
       if (!(await this.hasDiff(`origin/${branchName}`))) {
-        logger.warn(
+        logger.info(
           { branchName, fileNames },
-          'No file changes detected. Is this an empty force push?'
+          'No file changes detected. Skipping commit'
         );
+        return;
       }
       await this._git!.push('origin', `${branchName}:${branchName}`, {
         '--force': true,
-- 
GitLab