diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2012-04-16 03:04:29 -0400 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2012-04-16 03:05:42 -0400 |
commit | bdf21e45caadd74c7f4c41d6e1bf4737d9300cf4 (patch) | |
tree | 8bfc7ae6aa29d51b7aa3264604417e5da6b10b1d /git-tools | |
parent | f1f2ab92b15e57c182dadfd9f3cd606cff13946c (diff) | |
download | forums-bdf21e45caadd74c7f4c41d6e1bf4737d9300cf4.tar forums-bdf21e45caadd74c7f4c41d6e1bf4737d9300cf4.tar.gz forums-bdf21e45caadd74c7f4c41d6e1bf4737d9300cf4.tar.bz2 forums-bdf21e45caadd74c7f4c41d6e1bf4737d9300cf4.tar.xz forums-bdf21e45caadd74c7f4c41d6e1bf4737d9300cf4.zip |
[ticket/10767] Revert unconditional unfatality in commit-msg hook.
Revert "[ticket/10093] Make commit-msg always not fatal by nuking all fatal logic."
This reverts commit 88cad5523e7cdac6826dd8581e27e22a65afda26.
PHPBB3-10093
PHPBB3-10767
Diffstat (limited to 'git-tools')
-rwxr-xr-x | git-tools/hooks/commit-msg | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg index 52969670ca..3c42411602 100755 --- a/git-tools/hooks/commit-msg +++ b/git-tools/hooks/commit-msg @@ -12,6 +12,11 @@ # ln -s ../../git-tools/hooks/commit-msg \\ # .git/hooks/commit-msg # +# You can configure whether invalid commit messages abort commits: +# +# git config phpbb.hooks.commit-msg.fatal true (abort, this is the default) +# git config phpbb.hooks.commit-msg.fatal false (warn only, do not abort) +# # Warning/error messages use color by default if the output is a terminal # ("output" here is normally standard error when you run git commit). # To force or disable the use of color: @@ -21,6 +26,13 @@ config_ns="phpbb.hooks.commit-msg"; +if [ "$(git config --bool $config_ns.fatal)" = "false" ] +then + fatal=0; +else + fatal=1; +fi + debug_level=$(git config --int $config_ns.debug || echo 0); # Error codes @@ -47,9 +59,12 @@ debug() quit() { - # Now we always exit with success, since git will trash - # entered commit message if commit-msg hook exits with a failure. - exit 0 + if [ $1 -gt 0 ] && [ $1 -ne $ERR_UNKNOWN ] && [ $fatal -eq 0 ] + then + exit 0; + else + exit $1; + fi } use_color() |