diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-03-01 19:13:58 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-03-01 19:13:58 +0100 |
commit | 9f4908f0f2896d60c348f4e52ef4a200a8404bd7 (patch) | |
tree | 5d473acf6e5d48ee7ff242b5b6737f1d61adae07 | |
parent | 05d921fbbc6f60cebd18152c1413932c36dbe900 (diff) | |
parent | 42e8c2e8cf17f2937527404ee403b0e1cc1b0b70 (diff) | |
download | forums-9f4908f0f2896d60c348f4e52ef4a200a8404bd7.tar forums-9f4908f0f2896d60c348f4e52ef4a200a8404bd7.tar.gz forums-9f4908f0f2896d60c348f4e52ef4a200a8404bd7.tar.bz2 forums-9f4908f0f2896d60c348f4e52ef4a200a8404bd7.tar.xz forums-9f4908f0f2896d60c348f4e52ef4a200a8404bd7.zip |
Merge remote-tracking branch 'bantu/ticket/11509' into develop-olympus
* bantu/ticket/11509:
[ticket/11509] Exit with the expected (non-zero) exit status on failure.
[ticket/11509] Output which commit is being inspected.
[ticket/11509] Three dots means sym. difference, but we only want new commits.
-rw-r--r-- | .travis.yml | 2 | ||||
-rwxr-xr-x | git-tools/commit-msg-hook-range.sh | 29 |
2 files changed, 26 insertions, 5 deletions
diff --git a/.travis.yml b/.travis.yml index f576f1c800..44067cba3f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,4 +25,4 @@ before_script: script: - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.2' ]; then phpunit --configuration travis/phpunit-$DB-travis.xml; else phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml; fi" - - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' -a '$TRAVIS_PULL_REQUEST' != 'false' ]; then git-tools/commit-msg-hook-range.sh origin/$TRAVIS_BRANCH...FETCH_HEAD; fi" + - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysql' -a '$TRAVIS_PULL_REQUEST' != 'false' ]; then git-tools/commit-msg-hook-range.sh origin/$TRAVIS_BRANCH..FETCH_HEAD; fi" diff --git a/git-tools/commit-msg-hook-range.sh b/git-tools/commit-msg-hook-range.sh index 66628c1d17..2b408c3e79 100755 --- a/git-tools/commit-msg-hook-range.sh +++ b/git-tools/commit-msg-hook-range.sh @@ -5,26 +5,47 @@ # # 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)." + echo "Expected one argument (commit range, e.g. phpbb/develop..ticket/12345)." exit fi DIR=$(dirname "$0") -COMMIT_MSG_HOOK_PATH="$DIR/hooks/commit-msg" - 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 |