Top Description Fields Constructors Methods
org.eclipse.jgit.hooks

public Class PostCommitHook

extends GitHook<Void>
Class Inheritance
Imports
java.io.IOException, .PrintStream, org.eclipse.jgit.api.errors.AbortedByHookException, org.eclipse.jgit.lib.Repository, org.eclipse.jgit.util.ProcessResult

The post-commit hook implementation. This hook is run after the commit was successfully executed.
Since
4.5

Field Summary

Modifier and TypeField and Description
public static final String
NAME

The post-commit hook name.

Constructor Summary

AccessConstructor and Description
protected
PostCommitHook(Repository
The repository
repo
,
PrintStream
The output stream the hook must use. null is allowed, in which case the hook will use System.out.
outputStream
)

Constructor for PostCommitHook

This constructor will use the default error stream.

protected
PostCommitHook(Repository
The repository
repo
,
PrintStream
The output stream the hook must use. null is allowed, in which case the hook will use System.out.
outputStream
,
PrintStream
The error stream the hook must use. null is allowed, in which case the hook will use System.err.
errorStream
)

Constructor for PostCommitHook

Method Summary

Modifier and TypeMethod and Description
public Void
call()

Implements abstract org.eclipse.jgit.hooks.GitHook.call.

Implements java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

public String
getHookName()

Implements abstract org.eclipse.jgit.hooks.GitHook.getHookName.

Get name of the hook

protected void
handleError(String
error message
message
,
ProcessResult
The process result of the hook
result
)

Overrides org.eclipse.jgit.hooks.GitHook.handleError.

Overwrites the default implementation to never throw an AbortedByHookException, as the commit has already been done and the exit code of the post-commit hook has no effect.

Inherited from org.eclipse.jgit.hooks.GitHook:
doRungetErrorStreamgetOutputStreamgetParametersgetRepositorygetStdinArgsisNativeHookPresent

Field Detail

NAMEback to summary
public static final String NAME

The post-commit hook name.

Constructor Detail

PostCommitHookback to summary
protected PostCommitHook(Repository repo, PrintStream outputStream)

Constructor for PostCommitHook

This constructor will use the default error stream.

Parameters
repo:Repository

The repository

outputStream:PrintStream

The output stream the hook must use. null is allowed, in which case the hook will use System.out.

PostCommitHookback to summary
protected PostCommitHook(Repository repo, PrintStream outputStream, PrintStream errorStream)

Constructor for PostCommitHook

Parameters
repo:Repository

The repository

outputStream:PrintStream

The output stream the hook must use. null is allowed, in which case the hook will use System.out.

errorStream:PrintStream

The error stream the hook must use. null is allowed, in which case the hook will use System.err.

Since
5.6

Method Detail

callback to summary
public Void call() throws IOException, AbortedByHookException

Implements abstract org.eclipse.jgit.hooks.GitHook.call.

Implements java.util.concurrent.Callable.call.

Doc from org.eclipse.jgit.hooks.GitHook.call.

Computes a result, or throws an exception if unable to do so.

Run the hook.

Returns:Void

Doc from java.util.concurrent.Callable.call.

computed result

Annotations
@Override
getHookNameback to summary
public String getHookName()

Implements abstract org.eclipse.jgit.hooks.GitHook.getHookName.

Doc from org.eclipse.jgit.hooks.GitHook.getHookName.

Get name of the hook

Returns:String

The name of the hook, which must not be null.

Annotations
@Override
handleErrorback to summary
protected void handleError(String message, ProcessResult result) throws AbortedByHookException

Overrides org.eclipse.jgit.hooks.GitHook.handleError.

Overwrites the default implementation to never throw an AbortedByHookException, as the commit has already been done and the exit code of the post-commit hook has no effect.

Parameters
message:String

Doc from org.eclipse.jgit.hooks.GitHook.handleError.

error message

result:ProcessResult

Doc from org.eclipse.jgit.hooks.GitHook.handleError.

The process result of the hook

Annotations
@Override
Exceptions
AbortedByHookException:

Doc from org.eclipse.jgit.hooks.GitHook.handleError.

When the hook should be aborted