From 3b2cd51fa50d15016d3dc2ea2582e86961db973b Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Fri, 5 Sep 2014 15:45:21 +0300 Subject: [PATCH] Fix check for commit ranges in racing PRs. See #1768 / #2000 for original issue. See https://github.com/travis-ci/travis-ci/issues/1719#issuecomment-51705110 for problem description and origin of this fix. This is still a temporary fix until travis-ci/travis-core#383 is merged. --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fbd428c9824..0ca5ba872ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,8 @@ cache: before_install: - | if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then - TRAVIS_COMMIT_RANGE="FETCH_HEAD...$TRAVIS_BRANCH" + PR_FIRST=$(curl -s https://github.com/${TRAVIS_REPO_SLUG}/pull/${TRAVIS_PULL_REQUEST}.patch | head -1 | grep -o -E '\b[0-9a-f]{40}\b' | tr -d '\n') + TRAVIS_COMMIT_RANGE=$PR_FIRST^..$TRAVIS_COMMIT fi git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(^(docs|examples))/' || { echo "Only docs were updated, stopping build process."