diff options
| author | Xu Cheng | 2015-09-27 19:45:26 +0800 | 
|---|---|---|
| committer | Xu Cheng | 2015-09-28 21:46:58 +0800 | 
| commit | 79f71ca2ef7121d827f06f356c4c0d2d6610bdf0 (patch) | |
| tree | d66cfb918bd7eaed1580ebee78d430fdece40124 | |
| parent | 1b33c70d46fa49aae9817d9b8cba9f5b0d34a5d4 (diff) | |
| download | brew-79f71ca2ef7121d827f06f356c4c0d2d6610bdf0.tar.bz2 | |
travis: fix Could not parse object TRAVIS_COMMIT
If a PR is edited(e.g. force pushed) during the build.
TRAVIS_COMMIT will be lost. Refetching the merge ref wouldn't
help this situation as well. Since Travis already have reset
$TRAVIS_BUILD_DIR to the commit we need to test, let's use it to
determine TRAVIS_COMMIT directly.
Ref: https://github.com/travis-ci/travis-ci/issues/2666
| -rw-r--r-- | .travis.yml | 4 | 
1 files changed, 2 insertions, 2 deletions
| diff --git a/.travis.yml b/.travis.yml index 3ac23cb2e..87b5fa217 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,14 +16,14 @@ matrix:        rvm: system  before_install: +  - export TRAVIS_COMMIT=$(git rev-parse --verify -q HEAD) +  - cd /usr/local    - sudo rm -rf /usr/local/.git/refs /usr/local/.git/packed-refs    - sudo rsync -az "$TRAVIS_BUILD_DIR/" /usr/local/    - export TRAVIS_BUILD_DIR="/usr/local"    - sudo chown -R $USER /usr/local -  - cd /usr/local    - env | grep TRAVIS_    - if [ -f ".git/shallow" ]; then travis_retry git fetch --unshallow; fi -  - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then git reset --hard $TRAVIS_COMMIT || travis_retry git fetch origin +refs/pull/$TRAVIS_PULL_REQUEST/merge:; fi    - git reset --hard $TRAVIS_COMMIT    - git clean -qxdff | 
