Skip to content

Commit

Permalink
[BUG] Initalize Git for hook regeneration
Browse files Browse the repository at this point in the history
- 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 go-gitea#2414
  • Loading branch information
Gusted committed Feb 20, 2024
1 parent f128b6e commit 815abad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/admin_regenerate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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())
}

Expand Down

0 comments on commit 815abad

Please sign in to comment.