Skip to content

Commit 354ec3f

Browse files
peterschrammelsmowton
authored andcommitted
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. Amendment from upstream commit: removed --unshallow, which git rejects for this repository for unknown reasons.
1 parent edcbefa commit 354ec3f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

scripts/travis_doxygen.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@ pip install --user unidiff
88
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
99
$script_folder/run_diff.sh DOXYGEN HEAD~1 # Check for errors introduced in last commit
1010
else
11-
$script_folder/run_diff.sh DOXYGEN $TRAVIS_BRANCH # Check for errors compared to merge target
11+
TMP_HEAD=$(git rev-parse HEAD)
12+
git config remote.origin.fetch +refs/heads/$TRAVIS_BRANCH:refs/remotes/origin/$TRAVIS_BRANCH
13+
git fetch
14+
git checkout $TMP_HEAD
15+
$script_folder/run_diff.sh DOXYGEN origin/$TRAVIS_BRANCH # Check for errors compared to merge target
1216
fi

scripts/travis_lint.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@ pip install --user unidiff
88
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
99
$script_folder/run_diff.sh CPPLINT HEAD~1 # Check for errors introduced in last commit
1010
else
11-
$script_folder/run_diff.sh CPPLINT $TRAVIS_BRANCH # Check for errors compared to merge target
11+
TMP_HEAD=$(git rev-parse HEAD)
12+
git config remote.origin.fetch +refs/heads/$TRAVIS_BRANCH:refs/remotes/origin/$TRAVIS_BRANCH
13+
git fetch
14+
git checkout $TMP_HEAD
15+
$script_folder/run_diff.sh CPPLINT origin/$TRAVIS_BRANCH # Check for errors compared to merge target
1216
fi

0 commit comments

Comments
 (0)