public class PreCommitHook extends GitHook<java.lang.Void>
pre-commit
hook implementation. This hook is run before the
commit and can reject the commit.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME
The pre-commit hook name.
|
errorStream, outputStream
Modifier | Constructor and Description |
---|---|
protected |
PreCommitHook(Repository repo,
java.io.PrintStream outputStream)
Constructor for PreCommitHook
|
protected |
PreCommitHook(Repository repo,
java.io.PrintStream outputStream,
java.io.PrintStream errorStream)
Constructor for PreCommitHook
|
Modifier and Type | Method and Description |
---|---|
java.lang.Void |
call() |
java.lang.String |
getHookName()
Get name of the hook
|
doRun, getErrorStream, getOutputStream, getParameters, getRepository, getStdinArgs, isNativeHookPresent
public static final java.lang.String NAME
protected PreCommitHook(Repository repo, java.io.PrintStream outputStream)
This constructor will use the default error stream.
repo
- The repositoryoutputStream
- The output stream the hook must use. null
is allowed,
in which case the hook will use System.out
.protected PreCommitHook(Repository repo, java.io.PrintStream outputStream, java.io.PrintStream errorStream)
repo
- The repositoryoutputStream
- The output stream the hook must use. null
is allowed,
in which case the hook will use System.out
.errorStream
- The error stream the hook must use. null
is allowed,
in which case the hook will use System.err
.public java.lang.Void call() throws java.io.IOException, AbortedByHookException
Run the hook.
call
in interface java.util.concurrent.Callable<java.lang.Void>
call
in class GitHook<java.lang.Void>
java.io.IOException
AbortedByHookException
public java.lang.String getHookName()
getHookName
in class GitHook<java.lang.Void>
null
.