From e2de45edf6443b91562aac70fd52850d6331e2ec Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Tue, 12 May 2020 22:48:56 +0200
Subject: [PATCH] logs: improve auto-replace

---
 lib/workers/branch/auto-replace.ts | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/lib/workers/branch/auto-replace.ts b/lib/workers/branch/auto-replace.ts
index aa8f4f1533..1832986ea3 100644
--- a/lib/workers/branch/auto-replace.ts
+++ b/lib/workers/branch/auto-replace.ts
@@ -92,18 +92,6 @@ export async function doAutoReplace(
   existingContent: string,
   parentBranch: string | null
 ): Promise<string | null> {
-  if (parentBranch) {
-    if (!(await checkBranchDepsMatchBaseDeps(upgrade, existingContent))) {
-      logger.debug('Rebasing branch after deps list has changed');
-      return null;
-    }
-    if (!(await confirmIfDepUpdated(upgrade, existingContent))) {
-      logger.debug('Rebasing after outdated branch dep found');
-      return null;
-    }
-    logger.debug('Branch dep is already updated');
-    return existingContent;
-  }
   const {
     packageFile,
     depName,
@@ -113,6 +101,24 @@ export async function doAutoReplace(
     newDigest,
     autoReplaceStringTemplate,
   } = upgrade;
+  if (parentBranch) {
+    if (!(await checkBranchDepsMatchBaseDeps(upgrade, existingContent))) {
+      logger.debug(
+        { packageFile, depName },
+        'Rebasing branch after deps list has changed'
+      );
+      return null;
+    }
+    if (!(await confirmIfDepUpdated(upgrade, existingContent))) {
+      logger.debug(
+        { packageFile, depName },
+        'Rebasing after outdated branch dep found'
+      );
+      return null;
+    }
+    logger.debug({ packageFile, depName }, 'Branch dep is already updated');
+    return existingContent;
+  }
   const replaceString = upgrade.replaceString || currentValue;
   logger.trace({ depName, replaceString }, 'autoReplace replaceString');
   let searchIndex = existingContent.indexOf(replaceString);
-- 
GitLab