Skip to content

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

@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.

Activity

stale

stale commented on Oct 3, 2020

@stale

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @gabyx

        Issue actions

          Gitea repo creation overwrites hooks from e.g. `init.templateDir` · Issue #12411 · go-gitea/gitea