From 8c25dcf3cc0790b368cba3ac3e362fb69e8d8224 Mon Sep 17 00:00:00 2001 From: Peter Schrammel Date: Fri, 4 Aug 2017 19:27:33 +0100 Subject: [PATCH] Workaround for travis performing shallow clones with wrong branch travis clones a repo by 'git clone --depth 50 repo' which is ok if the PR target is the master branch. It should actually add '--branch= $TRAVIS_BRANCH' to the clone command. This commit provides a workaround. --- scripts/travis_doxygen.sh | 6 +++++- scripts/travis_lint.sh | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/travis_doxygen.sh b/scripts/travis_doxygen.sh index 78adcff3c13..359de72ff60 100755 --- a/scripts/travis_doxygen.sh +++ b/scripts/travis_doxygen.sh @@ -8,5 +8,9 @@ pip install --user unidiff if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then $script_folder/run_diff.sh DOXYGEN HEAD~1 # Check for errors introduced in last commit else - $script_folder/run_diff.sh DOXYGEN $TRAVIS_BRANCH # Check for errors compared to merge target + TMP_HEAD=$(git rev-parse HEAD) + git config remote.origin.fetch +refs/heads/$TRAVIS_BRANCH:refs/remotes/origin/$TRAVIS_BRANCH + git fetch --unshallow + git checkout $TMP_HEAD + $script_folder/run_diff.sh DOXYGEN origin/$TRAVIS_BRANCH # Check for errors compared to merge target fi diff --git a/scripts/travis_lint.sh b/scripts/travis_lint.sh index 036605237ee..6592a3ebdfa 100755 --- a/scripts/travis_lint.sh +++ b/scripts/travis_lint.sh @@ -8,5 +8,9 @@ pip install --user unidiff if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then $script_folder/run_diff.sh CPPLINT HEAD~1 # Check for errors introduced in last commit else - $script_folder/run_diff.sh CPPLINT $TRAVIS_BRANCH # Check for errors compared to merge target + TMP_HEAD=$(git rev-parse HEAD) + git config remote.origin.fetch +refs/heads/$TRAVIS_BRANCH:refs/remotes/origin/$TRAVIS_BRANCH + git fetch --unshallow + git checkout $TMP_HEAD + $script_folder/run_diff.sh CPPLINT origin/$TRAVIS_BRANCH # Check for errors compared to merge target fi