public interface


Known Indirect Subclasses

Class Overview

Request that is provided to repository-hook modules for inspection (pre-hooks and post-hooks). The request describes the ref changes that are about to be made (pre-hooks), or that have just been made (post-hooks).

A request is marked as a dry-run request when the proposed ref changes need to be quickly verified, for instance to determine whether a button in the web UI should be enabled. Hooks that are called with a dry-run request should avoid expensive checks and operations.


Public Methods
@Nonnull Map<String, Object> getContext()
Retrieves any additional context that was supplied to the request.
@Nonnull Collection<RefChange> getRefChanges()
@Nonnull Repository getRepository()
@Nonnull Optional<ScmHookDetails> getScmHookDetails()
@Nonnull RepositoryHookTrigger getTrigger()
boolean isDryRun()

Public Methods

@Nonnull public Map<String, Object> getContext ()

Retrieves any additional context that was supplied to the request. This context is intended to allow plugin developers to implement their own behavior around ref-changes. As a result, its contents are unspecified; they depend on the installed plugins.

On dry runs, the context will always be empty.

  • additional context provided when the ref-change was requested, if any

@Nonnull public Collection<RefChange> getRefChanges ()

  • the proposed ref changes. Can be empty for some dry-run requests where the target hash is not yet known because the relevant commit hasn't been created yet. As an example, this is the case for merge requests. In these cases, the specialized request type should provide sufficient information about the proposed change. For MergeHookRequest, this would be getFromRef() and getToRef().

@Nonnull public Repository getRepository ()

  • the repository that's being updated

@Nonnull public Optional<ScmHookDetails> getScmHookDetails ()

  • SCM level hook details, if available. This will only be available when the hook is called synchronously as part of an SCM hook (such as pre-receive).

@Nonnull public RepositoryHookTrigger getTrigger ()

  • the trigger of the request. This allows hook to adapt their logic based on the trigger.

public boolean isDryRun ()

  • true if this hook is a dry-run request, otherwise false