mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 19:46:54 +00:00
nocommit pre-hook
This commit is contained in:
parent
f0bf512dbb
commit
d3cb871783
5 changed files with 33 additions and 1 deletions
|
|
@ -161,6 +161,12 @@
|
||||||
entry: name-tests-test
|
entry: name-tests-test
|
||||||
language: python
|
language: python
|
||||||
files: (^|/)tests/.+\.py$
|
files: (^|/)tests/.+\.py$
|
||||||
|
- id: no-commit-keywords
|
||||||
|
name: "Don't commit when nocommit keyword is present"
|
||||||
|
entry: no-commit-keywords
|
||||||
|
language: script
|
||||||
|
always_run: true
|
||||||
|
types: [text]
|
||||||
- id: no-commit-to-branch
|
- id: no-commit-to-branch
|
||||||
name: "Don't commit to branch"
|
name: "Don't commit to branch"
|
||||||
entry: no-commit-to-branch
|
entry: no-commit-to-branch
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,9 @@
|
||||||
|
3.2.0 - 2020-06-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
### Features
|
||||||
|
- `no-commit-keywords`: block commits when 'nocommit' or other keywords are present
|
||||||
|
|
||||||
3.1.0 - 2020-05-20
|
3.1.0 - 2020-05-20
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,9 @@ Replaces or checks mixed line ending.
|
||||||
Assert that files in tests/ end in `_test.py`.
|
Assert that files in tests/ end in `_test.py`.
|
||||||
- Use `args: ['--django']` to match `test*.py` instead.
|
- Use `args: ['--django']` to match `test*.py` instead.
|
||||||
|
|
||||||
|
#### `no-commit-keywords`
|
||||||
|
Protect branches from checkins when 'nocommit' keyword is present. Used to remind the author to prevent work-in-progress state from being committed.
|
||||||
|
|
||||||
#### `no-commit-to-branch`
|
#### `no-commit-to-branch`
|
||||||
Protect specific branches from direct checkins.
|
Protect specific branches from direct checkins.
|
||||||
- Use `args: [--branch, staging, --branch, master]` to set the branch.
|
- Use `args: [--branch, staging, --branch, master]` to set the branch.
|
||||||
|
|
|
||||||
16
pre_commit_hooks/no_commit_keywords.sh
Normal file
16
pre_commit_hooks/no_commit_keywords.sh
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
NOCOMMIT_PRESENT=$(git grep --ignore-case nocommit)
|
||||||
|
|
||||||
|
if [ -n $NOCOMMIT_PRESENT ]
|
||||||
|
then
|
||||||
|
echo "#nocommit tagged - commit prevented"
|
||||||
|
echo $NOCOMMIT_PRESENT
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[metadata]
|
[metadata]
|
||||||
name = pre_commit_hooks
|
name = pre_commit_hooks
|
||||||
version = 3.1.0
|
version = 3.2.0
|
||||||
description = Some out-of-the-box hooks for pre-commit.
|
description = Some out-of-the-box hooks for pre-commit.
|
||||||
long_description = file: README.md
|
long_description = file: README.md
|
||||||
long_description_content_type = text/markdown
|
long_description_content_type = text/markdown
|
||||||
|
|
@ -52,6 +52,7 @@ console_scripts =
|
||||||
forbid-new-submodules = pre_commit_hooks.forbid_new_submodules:main
|
forbid-new-submodules = pre_commit_hooks.forbid_new_submodules:main
|
||||||
mixed-line-ending = pre_commit_hooks.mixed_line_ending:main
|
mixed-line-ending = pre_commit_hooks.mixed_line_ending:main
|
||||||
name-tests-test = pre_commit_hooks.tests_should_end_in_test:main
|
name-tests-test = pre_commit_hooks.tests_should_end_in_test:main
|
||||||
|
no-commit-keywords = pre_commit_hooks.no_commit_keywords:main
|
||||||
no-commit-to-branch = pre_commit_hooks.no_commit_to_branch:main
|
no-commit-to-branch = pre_commit_hooks.no_commit_to_branch:main
|
||||||
pre-commit-hooks-removed = pre_commit_hooks.removed:main
|
pre-commit-hooks-removed = pre_commit_hooks.removed:main
|
||||||
pretty-format-json = pre_commit_hooks.pretty_format_json:main
|
pretty-format-json = pre_commit_hooks.pretty_format_json:main
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue