commit-msg hook implementation. This hook is run before the
commit and can reject the commit. It passes one argument to the hook script,
which is the path to the COMMIT_MSG file, relative to the repository
workTree.
| Modifier and Type | Field and Description |
|---|---|
| private String | commitMessage
The commit message. |
| public static final String | NAME
Constant indicating the name of the commit-smg hook. |
| Access | Constructor and Description |
|---|---|
| protected | CommitMsgHook(Repository
The repository repo, PrintStream The output stream the hook must use. outputStream)null is allowed,
in which case the hook will use System.out.Constructor for CommitMsgHook This constructor will use the default error stream. |
| protected | CommitMsgHook(Repository
The repository repo, PrintStream The output stream the hook must use. outputStream, PrintStream null is allowed,
in which case the hook will use System.out.The error stream the hook must use. errorStream)null is allowed,
in which case the hook will use System.err.Constructor for CommitMsgHook |
| Modifier and Type | Method and Description |
|---|---|
| public String | call()
Implements abstract org. Implements java. Computes a result, or throws an exception if unable to do so. |
| private boolean | Returns: true if and only if the path to the message commit file
is not null (which would happen in a bare repository) and the
commit message is also not null.
|
| private String | Returns: The path to the commit edit message file relative to the repository's work tree, or null if the repository is bare.
|
| public String | |
| protected String[] | getParameters()
Overrides org. Override this method when needed to provide relevant parameters to the underlying hook script. |
| public CommitMsgHook | Returns: this for convenience.The commit message before the hook has run. commitMessage)It is mandatory to call this method with a non-null value before actually calling the hook. |
| commitMessage | back to summary |
|---|---|
| private String commitMessage The commit message. | |
| NAME | back to summary |
|---|---|
| public static final String NAME Constant indicating the name of the commit-smg hook. | |
| CommitMsgHook | back to summary |
|---|---|
| protected CommitMsgHook(Repository repo, PrintStream outputStream) Constructor for CommitMsgHook This constructor will use the default error stream.
| |
| CommitMsgHook | back to summary |
|---|---|
| protected CommitMsgHook(Repository repo, PrintStream outputStream, PrintStream errorStream) Constructor for CommitMsgHook
| |
| call | back to summary |
|---|---|
| public String call() throws IOException, AbortedByHookException Implements abstract org. Implements java. Doc from org. Computes a result, or throws an exception if unable to do so. Run the hook.
| |
| canRun | back to summary |
|---|---|
private boolean canRun()
| |
| getCommitEditMessageFilePath | back to summary |
|---|---|
private String getCommitEditMessageFilePath()
| |
| getHookName | back to summary |
|---|---|
| public String getHookName() Implements abstract org. Doc from org. Get name of the hook | |
| getParameters | back to summary |
|---|---|
| protected String[] getParameters() Overrides org. Doc from org. Override this method when needed to provide relevant parameters to the underlying hook script. The default implementation returns an empty array. This hook receives one parameter, which is the path to the file holding the current commit-msg, relative to the repository's work tree. | |
| setCommitMessage | back to summary |
|---|---|
| public CommitMsgHook setCommitMessage(String commitMessage) It is mandatory to call this method with a non-null value before actually calling the hook.
| |