Package org.eclipse.jgit.util

## Enum Hook

- java.lang.Object
- - java.lang.Enum<Hook>
  - - org.eclipse.jgit.util.Hook

All Implemented Interfaces:
  `Serializable`, `Comparable<Hook>`

    public enum Hook
    extends Enum<Hook>

An enum describing the different hooks a user can implement to customize his repositories.

Since:
  3.7

### Enum Constant Summary

Enum Constants
`COMMIT_MSG` Literal for the "commit-msg" git hook.
`POST_COMMIT` Literal for the "post-commit" git hook.
`POST_REWRITE` Literal for the "post-rewrite" git hook.
`PRE_COMMIT` Literal for the "pre-commit" git hook.
`PRE_REBASE` Literal for the "pre-rebase" git hook.
`PREPARE_COMMIT_MSG` Literal for the "prepare-commit-msg" git hook.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`String` `getName()`
`static Hook` `valueOf​(String name)` Returns the enum constant of this type with the specified name.
`static Hook[]` `values()` Returns an array containing the constants of this enum type, in the order they are declared.

### Methods inherited from class java.lang.Enum

`clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

### Enum Constant Detail

#### PRE_COMMIT

    public static final Hook PRE_COMMIT

Literal for the "pre-commit" git hook.

This hook is invoked by git commit, and can be bypassed with the "no-verify" option. It takes no parameter, and is invoked before obtaining the proposed commit log message and making a commit.

A non-zero exit code from the called hook means that the commit should be aborted.

#### PREPARE_COMMIT_MSG

    public static final Hook PREPARE_COMMIT_MSG

Literal for the "prepare-commit-msg" git hook.

This hook is invoked by git commit right after preparing the default message, and before any editing possibility is displayed to the user.

A non-zero exit code from the called hook means that the commit should be aborted.

#### COMMIT_MSG

    public static final Hook COMMIT_MSG

Literal for the "commit-msg" git hook.

This hook is invoked by git commit, and can be bypassed with the "no-verify" option. Its single parameter is the path to the file containing the prepared commit message (typically "<gitdir>/COMMIT-EDITMSG").

A non-zero exit code from the called hook means that the commit should be aborted.

#### POST_COMMIT

    public static final Hook POST_COMMIT

Literal for the "post-commit" git hook.

This hook is invoked by git commit. It takes no parameter and is invoked after a commit has been made.

The exit code of this hook has no significance.

#### POST_REWRITE

    public static final Hook POST_REWRITE

Literal for the "post-rewrite" git hook.

This hook is invoked after commands that rewrite commits (currently, only "git rebase" and "git commit --amend"). It a single argument denoting the source of the call (one of `rebase` or `amend`). It then accepts a list of rewritten commits through stdin, in the form `<old SHA-1> <new SHA-1>LF`.

The exit code of this hook has no significance.

#### PRE_REBASE

    public static final Hook PRE_REBASE

Literal for the "pre-rebase" git hook.

This hook is invoked right before the rebase operation runs. It accepts up to two parameters, the first being the upstream from which the branch to rebase has been forked. If the tip of the series of commits to rebase is HEAD, the other parameter is unset. Otherwise, that tip is passed as the second parameter of the script.

A non-zero exit code from the called hook means that the rebase should be aborted.

### Method Detail

#### values

    public static Hook[] values()

Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

    for (Hook c : Hook.values())
        System.out.println(c);

Returns:
  an array containing the constants of this enum type, in the order they are declared

#### valueOf

    public static Hook valueOf​(String name)

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
  `name` - the name of the enum constant to be returned.
Returns:
  the enum constant with the specified name
Throws:
  `IllegalArgumentException` - if this enum type has no constant with the specified name
  `NullPointerException` - if the argument is null

#### getName

    public String getName()

Returns:
  The name of this hook.