diff options
| author | Nils Adermann <naderman@naderman.de> | 2014-02-03 01:08:25 +0100 |
|---|---|---|
| committer | Nils Adermann <naderman@naderman.de> | 2014-02-03 01:08:25 +0100 |
| commit | 1f93d940fd40f9660676cb20e401f5b092bdf873 (patch) | |
| tree | 236026670ffe5b41bc073486ff70933d70f5ab1b | |
| parent | b88e070116acbab2022a5b7d6a457adfcf449126 (diff) | |
| parent | 32536880f4b1fd853a07865c2b55febbfe7a994c (diff) | |
| download | forums-1f93d940fd40f9660676cb20e401f5b092bdf873.tar forums-1f93d940fd40f9660676cb20e401f5b092bdf873.tar.gz forums-1f93d940fd40f9660676cb20e401f5b092bdf873.tar.bz2 forums-1f93d940fd40f9660676cb20e401f5b092bdf873.tar.xz forums-1f93d940fd40f9660676cb20e401f5b092bdf873.zip | |
Merge branch 'develop-olympus' into develop
* develop-olympus:
[ticket/11509] Fail on Travis CI if commit messages are improperly formatted.
Conflicts:
.travis.yml
| -rw-r--r-- | .travis.yml | 1 | ||||
| -rwxr-xr-x | git-tools/commit-msg-hook-range.sh | 30 |
2 files changed, 31 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml index 9b6544e23f..8323bd81ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,7 @@ before_script: script: - cd build - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' ]; then ../phpBB/vendor/bin/phing sniff; fi" + - sh -c "if [ '$TRAVIS_PULL_REQUEST' != 'false' ]; then git-tools/commit-msg-hook-range.sh $TRAVIS_COMMIT_RANGE; fi" - cd .. - phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml diff --git a/git-tools/commit-msg-hook-range.sh b/git-tools/commit-msg-hook-range.sh new file mode 100755 index 0000000000..66628c1d17 --- /dev/null +++ b/git-tools/commit-msg-hook-range.sh @@ -0,0 +1,30 @@ +#!/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. +# +set -e + +if [ "$#" -ne 1 ]; +then + echo "Expected one argument (commit range, e.g. eef1b586...1666476b)." + exit +fi + +DIR=$(dirname "$0") +COMMIT_MSG_HOOK_PATH="$DIR/hooks/commit-msg" + +COMMIT_RANGE="$1" + +for COMMIT_HASH in $(git rev-list --no-merges "$COMMIT_RANGE") +do + # 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" + "$COMMIT_MSG_HOOK_PATH" "$COMMIT_MESSAGE_PATH" + rm "$COMMIT_MESSAGE_PATH" +done |
