Skip to content

Add support for git hooks on GitPackCommand #616

@JohnnyJayJay

Description

@JohnnyJayJay

Description

JGit supports setting post-receive and pre-receive hooks on ReceivePack instances. It should be possible to use them with GitPackCommand, e.g. by allowing users to set suppliers of PostReceiveHook and PreReceiveHook on GitPackCommandFactory objects.

Motivation

There is currently no way to hook into the Git command handling, which means that what happens on remote updates of Git repos is completely opaque to users of mina-sshd. This is very limiting, since it makes it impossible to, for example, prevent certain refs from being pushed to, preventing force pushes (pre-receive) or kicking off something else if pushing succeeded (post-receive).

Alternatives considered

From what I've read, JGit is supposed to be able to run hooks that are on disk as executable files in the hooks directory, but it seems like this support is missing from ReceivePack. I haven't managed to get JGit to run those hooks either.

Additional context

/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions