Package org.eclipse.jgit.hooks
Class PreCommitHook
- java.lang.Object
-
- org.eclipse.jgit.hooks.GitHook<java.lang.Void>
-
- org.eclipse.jgit.hooks.PreCommitHook
-
- All Implemented Interfaces:
java.util.concurrent.Callable<java.lang.Void>
public class PreCommitHook extends GitHook<java.lang.Void>
Thepre-commithook implementation. This hook is run before the commit and can reject the commit.- Since:
- 4.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNAMEThe pre-commit hook name.
-
Constructor Summary
Constructors Modifier Constructor Description protectedPreCommitHook(Repository repo, java.io.PrintStream outputStream)Constructor for PreCommitHookprotectedPreCommitHook(Repository repo, java.io.PrintStream outputStream, java.io.PrintStream errorStream)Constructor for PreCommitHook
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Voidcall()java.lang.StringgetHookName()Get name of the hook-
Methods inherited from class org.eclipse.jgit.hooks.GitHook
doRun, getErrorStream, getOutputStream, getParameters, getRepository, getStdinArgs, handleError, isNativeHookPresent
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
The pre-commit hook name.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PreCommitHook
protected PreCommitHook(Repository repo, java.io.PrintStream outputStream)
Constructor for PreCommitHookThis constructor will use the default error stream.
- Parameters:
repo- The repositoryoutputStream- The output stream the hook must use.nullis allowed, in which case the hook will useSystem.out.
-
PreCommitHook
protected PreCommitHook(Repository repo, java.io.PrintStream outputStream, java.io.PrintStream errorStream)
Constructor for PreCommitHook- Parameters:
repo- The repositoryoutputStream- The output stream the hook must use.nullis allowed, in which case the hook will useSystem.out.errorStream- The error stream the hook must use.nullis allowed, in which case the hook will useSystem.err.- Since:
- 5.6
-
-
Method Detail
-
call
public java.lang.Void call() throws java.io.IOException, AbortedByHookExceptionRun the hook.
- Specified by:
callin interfacejava.util.concurrent.Callable<java.lang.Void>- Specified by:
callin classGitHook<java.lang.Void>- Throws:
java.io.IOExceptionAbortedByHookException
-
getHookName
public java.lang.String getHookName()
Get name of the hook- Specified by:
getHookNamein classGitHook<java.lang.Void>- Returns:
- The name of the hook, which must not be
null.
-
-