Top Description Fields Methods
org.eclipse.jgit.transport

public Interface PreReceiveHook

Known Direct Implementers
org.eclipse.jgit.transport.PreReceiveHookChain
Imports
java.util.Collection

Hook invoked by org.eclipse.jgit.transport.ReceivePack before any updates are executed.

The hook is called with any commands that are deemed valid after parsing them from the client and applying the standard receive configuration options to them:

This means the hook will not receive a non-fast-forward update command if denyNonFastForwards is set to true in the configuration file. To get all commands within the hook, see org.eclipse.jgit.transport.ReceivePack#getAllCommands().

As the hook is invoked prior to the commands being executed, the hook may choose to block any command by setting its result status with org.eclipse.jgit.transport.ReceiveCommand#setResult(ReceiveCommand.Result).

The hook may also choose to perform the command itself (or merely pretend that it has performed the command), by setting the result status to org.eclipse.jgit.transport.ReceiveCommand.Result#OK.

Hooks should run quickly, as they block the caller thread and the client process from completing.

Hooks may send optional messages back to the client via methods on org.eclipse.jgit.transport.ReceivePack. Implementors should be aware that not all network transports support this output, so some (or all) messages may simply be discarded. These messages should be advisory only.

Field Summary

Modifier and TypeField and Description
public static final PreReceiveHook
NULL

A simple no-op hook.

Method Summary

Modifier and TypeMethod and Description
public void
onPreReceive(ReceivePack
the process handling the current receive. Hooks may obtain details about the destination repository through this handle.
rp
,
Collection<ReceiveCommand>
unmodifiable set of valid commands still pending execution. May be the empty set.
commands
)

Invoked just before commands are executed.

Field Detail

NULLback to summary
public static final PreReceiveHook NULL

A simple no-op hook.

Method Detail

onPreReceiveback to summary
public void onPreReceive(ReceivePack rp, Collection<ReceiveCommand> commands)

Invoked just before commands are executed.

See the class description for how this method can impact execution.

Parameters
rp:ReceivePack

the process handling the current receive. Hooks may obtain details about the destination repository through this handle.

commands:Collection<ReceiveCommand>

unmodifiable set of valid commands still pending execution. May be the empty set.