Skip to content

Commit

Permalink
wip: support pre-merge-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile committed Nov 7, 2019
1 parent 0fd4a2e commit 3ad1264
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pre_commit/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
VERSION = importlib_metadata.version('pre_commit')

# `manual` is not invoked by any installed git hook. See #719
STAGES = ('commit', 'prepare-commit-msg', 'commit-msg', 'manual', 'push')
STAGES = (
'commit', 'merge-commit', 'prepare-commit-msg', 'commit-msg', 'manual',
'push',
)

DEFAULT = 'default'
3 changes: 2 additions & 1 deletion pre_commit/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def __call__(self, parser, namespace, values, option_string=None):
def _add_hook_type_option(parser):
parser.add_argument(
'-t', '--hook-type', choices=(
'pre-commit', 'pre-push', 'prepare-commit-msg', 'commit-msg',
'pre-commit', 'pre-merge-commit', 'pre-push',
'prepare-commit-msg', 'commit-msg',
),
action=AppendReplaceDefault,
default=['pre-commit'],
Expand Down
1 change: 1 addition & 0 deletions pre_commit/resources/hook-tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ def _opts(stdin):
fns = {
'prepare-commit-msg': lambda _: ('--commit-msg-filename', sys.argv[1]),
'commit-msg': lambda _: ('--commit-msg-filename', sys.argv[1]),
'pre-merge-commit': lambda _: (),
'pre-commit': lambda _: (),
'pre-push': _pre_push,
}
Expand Down

0 comments on commit 3ad1264

Please sign in to comment.