From 815abad84c68da1722f87c97a47b0e96a29f3967 Mon Sep 17 00:00:00 2001 From: Gusted Date: Tue, 20 Feb 2024 19:38:21 +0100 Subject: [PATCH] [BUG] Initalize Git for hook regeneration - The hook regeneration code relies on `git.SupportProcReceive` being set to determine if the `proc-receive` hook should be written, this variable is set when the git module is initialized. - Resolves #2414 --- cmd/admin_regenerate.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/admin_regenerate.go b/cmd/admin_regenerate.go index 0db505ff9c..efdfc8e5e4 100644 --- a/cmd/admin_regenerate.go +++ b/cmd/admin_regenerate.go @@ -5,6 +5,7 @@ package cmd import ( asymkey_model "code.gitea.io/gitea/models/asymkey" + "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/graceful" repo_service "code.gitea.io/gitea/services/repository" @@ -32,6 +33,12 @@ func runRegenerateHooks(_ *cli.Context) error { if err := initDB(ctx); err != nil { return err } + + // Detection of ProcReceive support relies on Git module being initalized. + if err := git.InitFull(ctx); err != nil { + return err + } + return repo_service.SyncRepositoryHooks(graceful.GetManager().ShutdownContext()) }