From f0a193dc13987af6b9e317e0d8e8cc84d179041c Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Sat, 15 May 2021 14:44:47 +0200
Subject: [PATCH] fix(config): drop non-selectors when cloning rules

---
 lib/config/__snapshots__/massage.spec.ts.snap | 1 +
 lib/config/massage.spec.ts                    | 1 +
 lib/config/massage.ts                         | 5 +++++
 3 files changed, 7 insertions(+)

diff --git a/lib/config/__snapshots__/massage.spec.ts.snap b/lib/config/__snapshots__/massage.spec.ts.snap
index 8738abb0d5..d2fef9508d 100644
--- a/lib/config/__snapshots__/massage.spec.ts.snap
+++ b/lib/config/__snapshots__/massage.spec.ts.snap
@@ -14,6 +14,7 @@ Object {
       "matchPackageNames": Array [
         "foo",
       ],
+      "separateMajorMinor": false,
     },
     Object {
       "matchPackageNames": Array [
diff --git a/lib/config/massage.spec.ts b/lib/config/massage.spec.ts
index bcf9d42647..714ba95202 100644
--- a/lib/config/massage.spec.ts
+++ b/lib/config/massage.spec.ts
@@ -27,6 +27,7 @@ describe(getName(), () => {
         packageRules: [
           {
             matchPackageNames: ['foo'],
+            separateMajorMinor: false,
             minor: {
               semanticCommitType: 'feat',
             },
diff --git a/lib/config/massage.ts b/lib/config/massage.ts
index 6d205d86ad..c1bc64d9d3 100644
--- a/lib/config/massage.ts
+++ b/lib/config/massage.ts
@@ -58,6 +58,11 @@ export function massageConfig(config: RenovateConfig): RenovateConfig {
       ][]) {
         if (updateTypes.includes(key)) {
           let newRule = clone(rule);
+          Object.keys(newRule).forEach((newKey) => {
+            if (!(newKey.startsWith(`match`) || newKey.startsWith('exclude'))) {
+              delete newRule[newKey];
+            }
+          });
           newRule.matchUpdateTypes = rule.matchUpdateTypes || [];
           newRule.matchUpdateTypes.push(key);
           newRule = { ...newRule, ...val };
-- 
GitLab