aboutsummaryrefslogtreecommitdiffstats
path: root/git-tools
diff options
context:
space:
mode:
authorThomas Backlund <tmb@mageia.org>2017-05-26 20:02:07 +0300
committerThomas Backlund <tmb@mageia.org>2017-05-26 20:02:07 +0300
commit5e6803684739dc0963d784c0cefd86697ad397f3 (patch)
tree8ab6acff6c8069c5ba3035cba3adec90dba24ba1 /git-tools
parent8fc97191a3533a1cce0b051baa55db68d83b5dc4 (diff)
parent11242dd07d6359a725f22f3674028adfdddb49d6 (diff)
downloadforums-5e6803684739dc0963d784c0cefd86697ad397f3.tar
forums-5e6803684739dc0963d784c0cefd86697ad397f3.tar.gz
forums-5e6803684739dc0963d784c0cefd86697ad397f3.tar.bz2
forums-5e6803684739dc0963d784c0cefd86697ad397f3.tar.xz
forums-5e6803684739dc0963d784c0cefd86697ad397f3.zip
Merge tag 'release-3.0.14' of https://github.com/phpbb/phpbb
Merge upstream 3.0.14 release.
Diffstat (limited to 'git-tools')
-rwxr-xr-xgit-tools/commit-msg-hook-range.sh51
-rwxr-xr-xgit-tools/hooks/commit-msg4
2 files changed, 53 insertions, 2 deletions
diff --git a/git-tools/commit-msg-hook-range.sh b/git-tools/commit-msg-hook-range.sh
new file mode 100755
index 0000000000..2b408c3e79
--- /dev/null
+++ b/git-tools/commit-msg-hook-range.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+#
+# @copyright (c) 2014 phpBB Group
+# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+#
+# Calls the git commit-msg hook on all non-merge commits in a given commit range.
+#
+
+if [ "$#" -ne 1 ];
+then
+ echo "Expected one argument (commit range, e.g. phpbb/develop..ticket/12345)."
+ exit
+fi
+
+DIR=$(dirname "$0")
+COMMIT_RANGE="$1"
+COMMIT_MSG_HOOK_PATH="$DIR/hooks/commit-msg"
+COMMIT_MSG_HOOK_FATAL=$(git config --bool phpbb.hooks.commit-msg.fatal 2> /dev/null)
+git config phpbb.hooks.commit-msg.fatal true
+
+EXIT_STATUS=0
+for COMMIT_HASH in $(git rev-list --no-merges "$COMMIT_RANGE")
+do
+ echo "Inspecting commit message of commit $COMMIT_HASH"
+
+ # The git commit-msg hook takes a path to a file containing a commit
+ # message. So we have to extract the commit message into a file first,
+ # which then also needs to be deleted after our work is done.
+ COMMIT_MESSAGE_PATH="$DIR/commit_msg.$COMMIT_HASH"
+ git log -n 1 --pretty=format:%B "$COMMIT_HASH" > "$COMMIT_MESSAGE_PATH"
+
+ # Invoke hook on commit message file.
+ "$COMMIT_MSG_HOOK_PATH" "$COMMIT_MESSAGE_PATH"
+
+ # If any commit message hook complains with a non-zero exit status, we
+ # will send a non-zero exit status upstream.
+ if [ $? -ne 0 ]
+ then
+ EXIT_STATUS=1
+ fi
+
+ rm "$COMMIT_MESSAGE_PATH"
+done
+
+# Restore phpbb.hooks.commit-msg.fatal config
+if [ -n "$COMMIT_MSG_HOOK_FATAL" ]
+then
+ git config phpbb.hooks.commit-msg.fatal "$COMMIT_MSG_HOOK_FATAL"
+fi
+
+exit $EXIT_STATUS
diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg
index b156d276df..136606252c 100755
--- a/git-tools/hooks/commit-msg
+++ b/git-tools/hooks/commit-msg
@@ -191,12 +191,12 @@ do
err=$ERR_HEADER;
echo "$line" | grep -Eq "^\[(ticket/[0-9]+|feature/$branch_regex|task/$branch_regex)\] .+$"
result=$?
- if ! echo "$line" | grep -Eq "^\[(ticket/[0-9]+|feature/$branch_regex|task/$branch_regex)\] [A-Z].+$"
+ if ! echo "$line" | grep -Eq "^\[(ticket/[0-9]+|feature/$branch_regex|task/$branch_regex)\] [a-zA-Z].+$"
then
# Don't be too strict.
# Commits may be temporary, intended to be squashed later.
# Just issue a warning here.
- complain "$severity: heading should be a sentence beginning with a capital letter." 1>&2
+ complain "$severity: heading should be a sentence beginning with a letter." 1>&2
complain "You entered:" 1>&2
complain "$line" 1>&2
fi