Skip to content

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

Open
@gabyx

Description

@gabyx
  • Gitea version (or commit ref): >1.11.2
  • Git version: 2.27
  • Operating system: Linux
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

When gitea creates a new repo, the following happens

  • git init --bare
    • git sets up a repository and copies files from init.templateDir.
      Assume there are ${init.templateDir}/hooks which get installed
  • gitea somehow overwrites the hooks in hooks (it does not look at core.hooksPath which is good).

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions