From da8f9cc3bc706e5584d505fac64e3831572ab2ac Mon Sep 17 00:00:00 2001
From: Michael Kriese <michael.kriese@visualon.de>
Date: Tue, 24 Jan 2023 07:22:45 +0100
Subject: [PATCH] fix(manager/pre-commit): remove wrong gitea support (#19936)

---
 lib/modules/manager/pre-commit/extract.spec.ts | 7 ++++++-
 lib/modules/manager/pre-commit/extract.ts      | 3 +--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/modules/manager/pre-commit/extract.spec.ts b/lib/modules/manager/pre-commit/extract.spec.ts
index d7278ae760..1939f50b1c 100644
--- a/lib/modules/manager/pre-commit/extract.spec.ts
+++ b/lib/modules/manager/pre-commit/extract.spec.ts
@@ -95,7 +95,12 @@ describe('modules/manager/pre-commit/extract', () => {
     });
 
     it('can handle private git repos', () => {
-      hostRules.find.mockReturnValue({ token: 'value' });
+      // url only
+      hostRules.find.mockReturnValueOnce({ token: 'value1' });
+      // hostType=github
+      hostRules.find.mockReturnValueOnce({});
+      // hostType=gitlab
+      hostRules.find.mockReturnValueOnce({ token: 'value' });
       const result = extractPackageFile(enterpriseGitPrecommitConfig, filename);
       expect(result).toEqual({
         deps: [
diff --git a/lib/modules/manager/pre-commit/extract.ts b/lib/modules/manager/pre-commit/extract.ts
index a97a248499..fa0ecb6a61 100644
--- a/lib/modules/manager/pre-commit/extract.ts
+++ b/lib/modules/manager/pre-commit/extract.ts
@@ -50,7 +50,6 @@ function determineDatasource(
     return { skipReason: 'unknown-registry', registryUrls: [hostname] };
   }
   for (const [hostType, sourceId] of [
-    ['gitea', GitlabTagsDatasource.id],
     ['github', GithubTagsDatasource.id],
     ['gitlab', GitlabTagsDatasource.id],
   ]) {
@@ -64,7 +63,7 @@ function determineDatasource(
   }
   logger.debug(
     { repository, registry: hostUrl },
-    'Provided hostname did not match any of the hostRules of hostType gitea,github nor gitlab'
+    'Provided hostname did not match any of the hostRules of hostType github nor gitlab'
   );
   return { skipReason: 'unknown-registry', registryUrls: [hostname] };
 }
-- 
GitLab