1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Move hooks function to gitrepo and reduce expose repopath (#33890)

Extract from #28966 
Follow #33874
This commit is contained in:
Lunny Xiao
2025-03-16 09:12:55 -07:00
committed by GitHub
parent 1ea5216f4a
commit 7fd44a85ca
8 changed files with 38 additions and 24 deletions

View File

@@ -41,7 +41,7 @@ func InitWiki(ctx context.Context, repo *repo_model.Repository) error {
if err := git.InitRepository(ctx, repo.WikiPath(), true, repo.ObjectFormatName); err != nil {
return fmt.Errorf("InitRepository: %w", err)
} else if err = repo_module.CreateDelegateHooks(repo.WikiPath()); err != nil {
} else if err = gitrepo.CreateDelegateHooksForWiki(ctx, repo); err != nil {
return fmt.Errorf("createDelegateHooks: %w", err)
} else if _, _, err = git.NewCommand("symbolic-ref", "HEAD").AddDynamicArguments(git.BranchPrefix+repo.DefaultWikiBranch).RunStdString(ctx, &git.RunOpts{Dir: repo.WikiPath()}); err != nil {
return fmt.Errorf("unable to set default wiki branch to %q: %w", repo.DefaultWikiBranch, err)