Package org.eclipse.jgit.hooks
Class PostCommitHook
- java.lang.Object
-
- org.eclipse.jgit.hooks.GitHook<Void>
-
- org.eclipse.jgit.hooks.PostCommitHook
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PostCommitHook(Repository repo, PrintStream outputStream)
Constructor for PostCommitHookprotected
PostCommitHook(Repository repo, PrintStream outputStream, PrintStream errorStream)
Constructor for PostCommitHook
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Void
call()
String
getHookName()
Get name of the hookprotected void
handleError(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 Detail
-
NAME
public static final String NAME
The post-commit hook name.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PostCommitHook
protected PostCommitHook(Repository repo, PrintStream outputStream)
Constructor for PostCommitHookThis constructor will use the default error stream.
- Parameters:
repo
- The repositoryoutputStream
- The output stream the hook must use.null
is allowed, in which case the hook will useSystem.out
.
-
PostCommitHook
protected PostCommitHook(Repository repo, PrintStream outputStream, PrintStream errorStream)
Constructor for PostCommitHook- Parameters:
repo
- The repositoryoutputStream
- The output stream the hook must use.null
is allowed, in which case the hook will useSystem.out
.errorStream
- The error stream the hook must use.null
is allowed, in which case the hook will useSystem.err
.- Since:
- 5.6
-
-
Method Detail
-
call
public Void call() throws IOException, AbortedByHookException
Run the hook.
- Specified by:
call
in interfaceCallable<Void>
- Specified by:
call
in classGitHook<Void>
- Throws:
IOException
AbortedByHookException
-
getHookName
public String getHookName()
Get name of the hook- Specified by:
getHookName
in classGitHook<Void>
- Returns:
- The name of the hook, which must not be
null
.
-
handleError
protected void handleError(String message, ProcessResult result) throws AbortedByHookException
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:
handleError
in classGitHook<Void>
- Parameters:
message
- error messageresult
- The process result of the hook- Throws:
AbortedByHookException
- When the hook should be aborted
-
-