mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 13:58:54 +00: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
1 changed files with 30 additions and 4 deletions
|
@ -12,6 +12,13 @@
|
||||||
# ln -s ../../git-tools/hooks/commit-msg \\
|
# ln -s ../../git-tools/hooks/commit-msg \\
|
||||||
# .git/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
|
# Warning/error messages use color by default if the output is a terminal
|
||||||
# ("output" here is normally standard error when you run git commit).
|
# ("output" here is normally standard error when you run git commit).
|
||||||
# To force or disable the use of color:
|
# To force or disable the use of color:
|
||||||
|
@ -21,6 +28,15 @@
|
||||||
|
|
||||||
config_ns="phpbb.hooks.commit-msg";
|
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);
|
debug_level=$(git config --int $config_ns.debug || echo 0);
|
||||||
|
|
||||||
# Error codes
|
# Error codes
|
||||||
|
@ -47,9 +63,19 @@ debug()
|
||||||
|
|
||||||
quit()
|
quit()
|
||||||
{
|
{
|
||||||
# Now we always exit with success, since git will trash
|
if [ $1 -eq 0 ] || [ $1 -eq $ERR_UNKNOWN ]
|
||||||
# entered commit message if commit-msg hook exits with a failure.
|
then
|
||||||
exit 0
|
# 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()
|
use_color()
|
||||||
|
@ -170,7 +196,7 @@ do
|
||||||
# Don't be too strict.
|
# Don't be too strict.
|
||||||
# Commits may be temporary, intended to be squashed later.
|
# Commits may be temporary, intended to be squashed later.
|
||||||
# Just issue a warning here.
|
# 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 "You entered:" 1>&2
|
||||||
complain "$line" 1>&2
|
complain "$line" 1>&2
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue