Skip to content

Support post-merge and post-commit git hooks #5120

@stealthybox

Description

@stealthybox
  • Gogs version: 0.11.34.1122
  • Git version: 1.8.3.1
  • Operating system: CentOS Linux release 7.4.1708 (Core)
  • Database:
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gogs.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Description

It would be useful to support post-merge and other git hooks intended for local use on the gogs remote.

My use-case would be to run a git hook when a pull-request is merged.

This is part of the use case in #96 -- it's possible to run hooks when a user pushes to the repo's remote but not when gogs modifies the repo locally such when merging a pull request or modifying files in the web UI.

post-commit may be useful for resolving #4338.

However, I don't believe these hooks are supported on bare repositories.
I tried manually adding post-commit and post-merge hooks to the gogs bare repo, and they did not run when editing files in the UI or merging pull-requests.

We could exec these hooks during these actions from the Web UI, but that would make the behavior non-standard.
If we write code to exec scripts in a non-standard way, we could name the files in a gogs namespace such as ./hooks/gogs-post-merge or ./hooks/gogs/post-commit

cc: @unknwon / @xiayhub

Metadata

Metadata

Assignees

No one assigned

    Labels

    🎯 featureCategorizes as related to a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions