From e24fe313eb8ed36c6553f507aed285d47d00c2d6 Mon Sep 17 00:00:00 2001
From: Michael Kriese <michael.kriese@visualon.de>
Date: Fri, 12 Aug 2022 09:39:19 +0200
Subject: [PATCH] fix: set `newVersion` for pin updates (#17150)

---
 .../process/lookup/__snapshots__/index.spec.ts.snap   | 11 +++++++++++
 lib/workers/repository/process/lookup/index.ts        |  5 +++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/lib/workers/repository/process/lookup/__snapshots__/index.spec.ts.snap b/lib/workers/repository/process/lookup/__snapshots__/index.spec.ts.snap
index 0ff2ce6852..e9d26f2cae 100644
--- a/lib/workers/repository/process/lookup/__snapshots__/index.spec.ts.snap
+++ b/lib/workers/repository/process/lookup/__snapshots__/index.spec.ts.snap
@@ -6,6 +6,7 @@ Array [
     "isPin": true,
     "newMajor": 0,
     "newValue": "0.4.4",
+    "newVersion": "0.4.4",
     "updateType": "pin",
   },
   Object {
@@ -40,6 +41,7 @@ Array [
     "isPin": true,
     "newMajor": 0,
     "newValue": "==0.9.4",
+    "newVersion": "0.9.4",
     "updateType": "pin",
   },
   Object {
@@ -311,6 +313,7 @@ Array [
     "isPin": true,
     "newMajor": 0,
     "newValue": "0.9.7",
+    "newVersion": "0.9.7",
     "updateType": "pin",
   },
   Object {
@@ -357,6 +360,7 @@ Array [
     "isPin": true,
     "newMajor": 1,
     "newValue": "1.4.1",
+    "newVersion": "1.4.1",
     "updateType": "pin",
   },
 ]
@@ -452,6 +456,7 @@ Array [
     "isPin": true,
     "newMajor": 0,
     "newValue": "0.4.4",
+    "newVersion": "0.4.4",
     "updateType": "pin",
   },
   Object {
@@ -1119,6 +1124,7 @@ Array [
     "isPin": true,
     "newMajor": 0,
     "newValue": "0.4.4",
+    "newVersion": "0.4.4",
     "updateType": "pin",
   },
   Object {
@@ -1148,6 +1154,7 @@ Array [
     "isPin": true,
     "newMajor": 0,
     "newValue": "0.4.4",
+    "newVersion": "0.4.4",
     "updateType": "pin",
   },
   Object {
@@ -1207,6 +1214,7 @@ Array [
     "isPin": true,
     "newMajor": 1,
     "newValue": "1.3.0",
+    "newVersion": "1.3.0",
     "updateType": "pin",
   },
   Object {
@@ -1447,6 +1455,7 @@ Array [
     "isPin": true,
     "newMajor": 1,
     "newValue": "1.0.1",
+    "newVersion": "1.0.1",
     "updateType": "pin",
   },
   Object {
@@ -1547,6 +1556,7 @@ Array [
     "isPin": true,
     "newMajor": 1,
     "newValue": "1.3.0",
+    "newVersion": "1.3.0",
     "updateType": "pin",
   },
   Object {
@@ -1596,6 +1606,7 @@ Array [
     "isPin": true,
     "newMajor": 1,
     "newValue": "1.0.0",
+    "newVersion": "1.0.0",
     "updateType": "pin",
   },
   Object {
diff --git a/lib/workers/repository/process/lookup/index.ts b/lib/workers/repository/process/lookup/index.ts
index a9eb5af858..5c7ff21976 100644
--- a/lib/workers/repository/process/lookup/index.ts
+++ b/lib/workers/repository/process/lookup/index.ts
@@ -206,20 +206,21 @@ export async function lookupUpdates(
       res.currentVersion = currentVersion!;
       if (
         currentValue &&
-        // TODO #7154
-        currentVersion! &&
+        currentVersion &&
         rangeStrategy === 'pin' &&
         !versioning.isSingleVersion(currentValue)
       ) {
         res.updates.push({
           updateType: 'pin',
           isPin: true,
+          // TODO: newValue can be null! (#7154)
           newValue: versioning.getNewValue({
             currentValue,
             rangeStrategy,
             currentVersion,
             newVersion: currentVersion,
           })!,
+          newVersion: currentVersion,
           newMajor: versioning.getMajor(currentVersion)!,
         });
       }
-- 
GitLab