From 0fc01f57df1da9c48e0aa7e4a4a475961bb647d5 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Thu, 25 May 2023 14:38:42 +0200
Subject: [PATCH] fix: skip commit message sync for platform=local (#22423)

---
 lib/util/git/index.ts | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/lib/util/git/index.ts b/lib/util/git/index.ts
index ec518a307f..0c857b7f55 100644
--- a/lib/util/git/index.ts
+++ b/lib/util/git/index.ts
@@ -504,13 +504,19 @@ export function getBranchCommit(branchName: string): CommitSha | null {
 }
 
 export async function getCommitMessages(): Promise<string[]> {
-  await syncGit();
   logger.debug('getCommitMessages');
-  const res = await git.log({
-    n: 20,
-    format: { message: '%s' },
-  });
-  return res.all.map((commit) => commit.message);
+  if (GlobalConfig.get('platform') !== 'local') {
+    await syncGit();
+  }
+  try {
+    const res = await git.log({
+      n: 20,
+      format: { message: '%s' },
+    });
+    return res.all.map((commit) => commit.message);
+  } catch (err) /* istanbul ignore next */ {
+    return [];
+  }
 }
 
 export async function checkoutBranch(branchName: string): Promise<CommitSha> {
-- 
GitLab