Package org.eclipse.jgit.hooks
Class PreCommitHook
The
pre-commit hook implementation. This hook is run before the
commit and can reject the commit.- Since:
- 4.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPreCommitHook(Repository repo, PrintStream outputStream) Constructor for PreCommitHookprotectedPreCommitHook(Repository repo, PrintStream outputStream, PrintStream errorStream) Constructor for PreCommitHook -
Method Summary
Methods inherited from class org.eclipse.jgit.hooks.GitHook
doRun, getErrorStream, getOutputStream, getParameters, getRepository, getStdinArgs, handleError, isNativeHookPresent
-
Field Details
-
NAME
The pre-commit hook name.- See Also:
-
-
Constructor Details
-
PreCommitHook
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
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 Details
-
call
Run the hook.
- Specified by:
callin interfaceCallable<Void>- Specified by:
callin classGitHook<Void>- Throws:
IOExceptionAbortedByHookException
-
getHookName
Get name of the hook- Specified by:
getHookNamein classGitHook<Void>- Returns:
- The name of the hook, which must not be
null.
-