| Modifier and Type | Field and Description |
|---|---|
protected PrintStream |
errorStream
The error stream to be used by the hook.
|
static String |
NAME
The pre-commit hook name.
|
protected PrintStream |
outputStream
The output stream to be used by the hook.
|
| Modifier | Constructor and Description |
|---|---|
protected |
PreCommitHook(Repository repo,
PrintStream outputStream)
Constructor for PreCommitHook
|
protected |
PreCommitHook(Repository repo,
PrintStream outputStream,
PrintStream errorStream)
Constructor for PreCommitHook
|
| Modifier and Type | Method and Description |
|---|---|
Void |
call() |
protected void |
doRun()
Runs the hook, without performing any validity checks.
|
protected PrintStream |
getErrorStream()
Get error stream
|
String |
getHookName()
Get name of the hook
|
protected PrintStream |
getOutputStream()
Get output stream
|
protected String[] |
getParameters()
Override this method when needed to provide relevant parameters to the
underlying hook script.
|
protected Repository |
getRepository()
Get the repository
|
protected String |
getStdinArgs()
Override to provide relevant arguments via stdin to the underlying hook
script.
|
boolean |
isNativeHookPresent()
Check whether a 'native' (i.e.
|
public static final String NAME
protected final PrintStream outputStream
protected final PrintStream errorStream
protected PreCommitHook(Repository repo, 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, PrintStream outputStream, 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 Void call() throws IOException, AbortedByHookException
Run the hook.
call in interface Callable<Void>IOExceptionAbortedByHookExceptionpublic String getHookName()
null.protected Repository getRepository()
protected String[] getParameters()
protected String getStdinArgs()
null.protected PrintStream getOutputStream()
null,
System.out is returned by default.protected PrintStream getErrorStream()
null,
System.err is returned by default.protected void doRun()
throws AbortedByHookException
AbortedByHookException - If the underlying hook script exited with non-zero.public boolean isNativeHookPresent()
Copyright © 2020 Eclipse JGit Project. All rights reserved.