diff options
author | Igor Wiedler <igor@wiedler.ch> | 2012-07-21 15:36:25 +0200 |
---|---|---|
committer | Igor Wiedler <igor@wiedler.ch> | 2012-07-21 15:36:25 +0200 |
commit | 5d57caee58c58d2a9c283abe8fe88f4eaec9f662 (patch) | |
tree | cd36469a74bf6847e5305d1fb8f4ac35266813e2 /git-tools/hooks | |
parent | 3ebe89cb7eff57c3ffdbe0b7dcd9cdc35b48d26b (diff) | |
parent | 841ea0e494504400c798faa6cc860dd1179e1004 (diff) | |
download | forums-5d57caee58c58d2a9c283abe8fe88f4eaec9f662.tar forums-5d57caee58c58d2a9c283abe8fe88f4eaec9f662.tar.gz forums-5d57caee58c58d2a9c283abe8fe88f4eaec9f662.tar.bz2 forums-5d57caee58c58d2a9c283abe8fe88f4eaec9f662.tar.xz forums-5d57caee58c58d2a9c283abe8fe88f4eaec9f662.zip |
Merge branch 'develop' into feature/dic
* develop: (441 commits)
[feature/new-tz-handling] Don't use global user but make it a parameter
[feature/new-tz-handling] Fix size of suggestion button in chrome
[feature/new-tz-handling] Fall back to UTC, if the timezone is invalid
[feature/new-tz-handling] Add previous selected value to validation if valid
[feature/new-tz-handling] Display suggestion when a different value is selected
[ticket/10998] Add border-radius to forum rules block - prosilver
[feature/new-tz-handling] Remove additional marking of selected items
[feature/new-tz-handling] Move update helper function to new class
[feature/new-tz-handling] Fix unit test
[feature/new-tz-handling] Delete old variable which is not used anymore
[feature/new-tz-handling] Rename $user->tz back to $user->timezone
[feature/pagination-as-list] New parameter for name of start var
[feature/pagination-as-list] Updates for nils comments
[feature/pagination-as-list] Rename and deprecate functions
[feature/pagination-as-list] Various fixes and improvements
[ticket/10968] Render pagination within the template
[feature/new-tz-handling] Remove "timezone might be numeric"
[feature/new-tz-handling] Add function to update the timezone
[feature/new-tz-handling] Correctly update user and board timezones on update
[ticket/10996] Use correct DBMS name in Travis config for PostgreSQL
...
Conflicts:
phpBB/common.php
phpBB/composer.json
phpBB/composer.lock
tests/cron/task_provider_test.php
Diffstat (limited to 'git-tools/hooks')
-rwxr-xr-x | git-tools/hooks/commit-msg | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg index 52969670ca..b156d276df 100755 --- a/git-tools/hooks/commit-msg +++ b/git-tools/hooks/commit-msg @@ -12,6 +12,13 @@ # 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) +# git config phpbb.hooks.commit-msg.fatal false (warn only, do not abort) +# +# The default is to warn only. +# # 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 +28,15 @@ config_ns="phpbb.hooks.commit-msg"; +if [ "$(git config --bool $config_ns.fatal)" = "true" ] +then + fatal=1; + severity=Error; +else + fatal=0; + severity=Warning; +fi + debug_level=$(git config --int $config_ns.debug || echo 0); # Error codes @@ -47,9 +63,19 @@ 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 -eq 0 ] || [ $1 -eq $ERR_UNKNOWN ] + then + # success + exit 0; + elif [ $fatal -eq 0 ] + then + # problems found but fatal is false + complain 'Please run `git commit --amend` and fix the problems mentioned.' 1>&2 + exit 0; + else + complain "Aborting commit." 1>&2 + exit $1; + fi } use_color() @@ -170,7 +196,7 @@ do # Don't be too strict. # Commits may be temporary, intended to be squashed later. # Just issue a warning here. - complain "Warning: heading should be a sentence beginning with a capital letter." 1>&2 + complain "$severity: heading should be a sentence beginning with a capital letter." 1>&2 complain "You entered:" 1>&2 complain "$line" 1>&2 fi |