public interface PreReceiveHook
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:
receive.denyDenyDeletes
receive.denyNonFastForwards
BaseReceivePack.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
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
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
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.
Modifier and Type | Field and Description |
---|---|
static PreReceiveHook |
NULL
A simple no-op hook.
|
Modifier and Type | Method and Description |
---|---|
void |
onPreReceive(ReceivePack rp,
Collection<ReceiveCommand> commands)
Invoked just before commands are executed.
|
static final PreReceiveHook NULL
void onPreReceive(ReceivePack rp, Collection<ReceiveCommand> commands)
See the class description for how this method can impact execution.
rp
- the process handling the current receive. Hooks may obtain
details about the destination repository through this handle.commands
- unmodifiable set of valid commands still pending execution.
May be the empty set.Copyright © 2015 Eclipse JGit Project. All rights reserved.