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

public Class PreCommitHook

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

The pre-commit hook implementation. This hook is run before the commit and can reject the commit.
Since
4.0

Field Summary

Modifier and TypeField and Description
public static final String
NAME

The pre-commit hook name.

Constructor Summary

AccessConstructor and Description
protected
PreCommitHook(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 PreCommitHook

This constructor will use the default error stream.

protected
PreCommitHook(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 PreCommitHook

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

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

Field Detail

NAMEback to summary
public static final String NAME

The pre-commit hook name.

Constructor Detail

PreCommitHookback to summary
protected PreCommitHook(Repository repo, PrintStream outputStream)

Constructor for PreCommitHook

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.

PreCommitHookback to summary
protected PreCommitHook(Repository repo, PrintStream outputStream, PrintStream errorStream)

Constructor for PreCommitHook

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