mirror of
https://github.com/phpbb/phpbb.git
synced 2025-04-21 08:12:17 +02:00
Merge remote-tracking branch 'p/ticket/10767' into develop-olympus
* p/ticket/10767: [ticket/10767] Clarify what happens at the end of the hook. [ticket/10767] Use warning/error language as appropriate. [ticket/10767] Default to non-fatal behavior. [ticket/10767] Revert unconditional unfatality in commit-msg hook.
This commit is contained in:
commit
31fbc40a09
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user