diff --git a/ci/lint/06_script.sh b/ci/lint/06_script.sh index cafabaff73..c2d6146068 100755 --- a/ci/lint/06_script.sh +++ b/ci/lint/06_script.sh @@ -7,7 +7,11 @@ export LC_ALL=C if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then - test/lint/commit-script-check.sh $TRAVIS_COMMIT_RANGE + # TRAVIS_BRANCH will be present in a Travis environment. For builds triggered + # by a pull request this is the name of the branch targeted by the pull request. + # https://docs.travis-ci.com/user/environment-variables/ + COMMIT_RANGE="$TRAVIS_BRANCH..HEAD" + test/lint/commit-script-check.sh $COMMIT_RANGE fi # This only checks that the trees are pure subtrees, it is not doing a full diff --git a/test/lint/lint-git-commit-check.sh b/test/lint/lint-git-commit-check.sh index b0cdd82f60..5df1380cd1 100755 --- a/test/lint/lint-git-commit-check.sh +++ b/test/lint/lint-git-commit-check.sh @@ -27,6 +27,7 @@ if [ -z "${COMMIT_RANGE}" ]; then if [ -n "$1" ]; then COMMIT_RANGE="HEAD~$1...HEAD" else + # This assumes that the target branch of the pull request will be develop MERGE_BASE=$(git merge-base HEAD develop) COMMIT_RANGE="$MERGE_BASE..HEAD" fi diff --git a/test/lint/lint-whitespace.sh b/test/lint/lint-whitespace.sh index 8f9ecbf1d4..c9dd5594bf 100755 --- a/test/lint/lint-whitespace.sh +++ b/test/lint/lint-whitespace.sh @@ -26,7 +26,9 @@ if [ -z "${COMMIT_RANGE}" ]; then if [ -n "$1" ]; then COMMIT_RANGE="HEAD~$1...HEAD" else - COMMIT_RANGE="HEAD" + # This assumes that the target branch of the pull request will be develop. + MERGE_BASE=$(git merge-base HEAD develop) + COMMIT_RANGE="$MERGE_BASE..HEAD" fi fi