go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.24k stars 5.42k forks source link

Gitea repo creation overwrites hooks from e.g. `init.templateDir` #12411

Open gabyx opened 4 years ago

gabyx commented 4 years ago

Description

When gitea creates a new repo, the following happens

This overwritting behavior is problematic. It is clear that gitea needs to install the hooks somewhere, and thats not so trivial, since the admin (as me) could have setup a global hooks dispatcher (see https://github.com/rycus86/githooks)

A better strategy would be to call a customizable setup script which is run after gitea has created the bare repo. The default implementation is exactly as today, but so that we can adapt this script. A git config --global core.hooksPath should not be supported because it's the same for all repositories, gitea wants the flexibiliy to edit/save hooks from the web-interface fo each repository and needs to place them best in the repository's own hooks/update.d (etc..) folder...

This means the setup-script.sh is called like

bash setup-repo.sh "repoPath" "gitea-hooks-dir-to-be-placed"

In this way we can replace the initial hooks of gitea, replace them with the global hooks dispatcher and incorporate the gitea hooks.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.