Package org.eclipse.jgit.hooks
Class PostCommitHook
The
post-commit hook implementation. This hook is run after the
commit was successfully executed.- Since:
- 4.5
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPostCommitHook(Repository repo, PrintStream outputStream) Constructor for PostCommitHookprotectedPostCommitHook(Repository repo, PrintStream outputStream, PrintStream errorStream) Constructor for PostCommitHook -
Method Summary
Modifier and TypeMethodDescriptioncall()Get name of the hookprotected voidhandleError(String message, ProcessResult result) Overwrites the default implementation to never throw anAbortedByHookException, as the commit has already been done and the exit code of the post-commit hook has no effect.Methods inherited from class org.eclipse.jgit.hooks.GitHook
doRun, getErrorStream, getOutputStream, getParameters, getRepository, getStdinArgs, isNativeHookPresent
-
Field Details
-
NAME
The post-commit hook name.- See Also:
-
-
Constructor Details
-
PostCommitHook
Constructor for PostCommitHookThis 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.
-
PostCommitHook
Constructor for PostCommitHook- 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.
-
handleError
Overwrites the default implementation to never throw anAbortedByHookException, as the commit has already been done and the exit code of the post-commit hook has no effect.- Overrides:
handleErrorin classGitHook<Void>- Parameters:
message- error messageresult- The process result of the hook- Throws:
AbortedByHookException- When the hook should be aborted
-