Skip to content

Commit a91ab86

Browse files
committed
lint: Use TRAVIS_BRANCH in lint-git-commit-check.sh
1 parent c11dc99 commit a91ab86

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/lint/lint-git-commit-check.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,18 @@ while getopts "?" opt; do
2323
esac
2424
done
2525

26+
# TRAVIS_BRANCH will be present in a Travis environment. For builds triggered
27+
# by a pull request this is the name of the branch targeted by the pull request.
28+
# https://docs.travis-ci.com/user/environment-variables/
29+
if [ -n "${TRAVIS_BRANCH}" ]; then
30+
COMMIT_RANGE="$TRAVIS_BRANCH..HEAD"
31+
fi
32+
2633
if [ -z "${COMMIT_RANGE}" ]; then
2734
if [ -n "$1" ]; then
2835
COMMIT_RANGE="HEAD~$1...HEAD"
2936
else
37+
# This assumes that the target branch of the pull request will be master.
3038
MERGE_BASE=$(git merge-base HEAD master)
3139
COMMIT_RANGE="$MERGE_BASE..HEAD"
3240
fi

0 commit comments

Comments
 (0)