Skip to content

Commit 181a74d

Browse files
committed
Travis clang-format, cpplint: Use the merge base
We previously looked at the diff to the current head of the target branch, which may have moved in comparison to the merge base of a pull request. Thus we sometimes ended up with spurious clang-format errors, talking about changes introduced in another PR.
1 parent ae2264d commit 181a74d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
clang-format-7 --version
1919
# build a pathspec that excludes the files in .clang-format-ignore
2020
while read file ; do echo EXCLUDES+="':(top,exclude)$file' " ; done < .clang-format-ignore
21-
git-clang-format-7 --binary clang-format-7 "${TRAVIS_BRANCH}" -- $EXCLUDES
21+
git-clang-format-7 --binary clang-format-7 "${TRAVIS_COMMIT_RANGE%...*}" -- $EXCLUDES
2222
git diff > formatted.diff
2323
if [[ -s formatted.diff ]] ; then
2424
echo 'Formatting error! The following diff shows the required changes'

scripts/travis_lint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ else
1212
git config remote.origin.fetch +refs/heads/$TRAVIS_BRANCH:refs/remotes/origin/$TRAVIS_BRANCH
1313
git fetch --unshallow
1414
git checkout $TMP_HEAD
15-
$script_folder/run_diff.sh CPPLINT origin/$TRAVIS_BRANCH # Check for errors compared to merge target
15+
$script_folder/run_diff.sh CPPLINT ${TRAVIS_COMMIT_RANGE%...*} # Check for errors compared to merge base
1616
fi

0 commit comments

Comments
 (0)