Merge #20071: ci, lint: Remove usage of TRAVIS_COMMIT_RANGE

BACKPORT NOTICE
There's some difference with original PR but that's not important because we do not actually use travis.
The variable TRAVIS_BRANCH would be removed anyway in bitcoin#20697 - let's just skip it for simplicity
--------------

a91ab86fae91d416d664d19d2f482a8d19c115a6 lint: Use TRAVIS_BRANCH in lint-git-commit-check.sh (Fabian Jahr)
c11dc995c98e908dfd9cea64d4b34329b1dbb5c6 lint: Don't use TRAVIS_COMMIT_RANGE in whitespace linter (Fabian Jahr)
1b41ce8f5f3debae03ca60e4acada14680df9185 lint: Don't use TRAVIS_COMMIT_RANGE for commit-script-check (Fabian Jahr)

Pull request description:

  This is causing problems again, very similar to #19654.

  UPDATE: This now removes all remaining usages of TRAVIS_COMMIT_RANGE and instead uses TRAVIS_BRANCH for the range, including `lint-git-commit-check` where TRAVIS_COMMIT_RANGE had already been removed. For builds triggered by a pull request, TRAVIS_BRANCH is the name of the branch targeted by the pull request. In the linters there is still a fallback that assumes master as the target branch.

ACKs for top commit:
  sipa:
    ACK a91ab86fae91d416d664d19d2f482a8d19c115a6. See test I tried in #20075.

Tree-SHA512: 1378bdebd5d8787a83fbda5d9999cc9447209423e7f0218fe5eb240e6a32dc1b51d1cd53b4f8cd1f71574d935ac5e22e203dfe09cce17e9976a48416038e1263
This commit is contained in:
MarcoFalke 2020-10-04 09:02:29 +02:00 committed by pasta
parent 980f9b6673
commit a53ef19d99
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984
3 changed files with 9 additions and 2 deletions

View File

@ -7,7 +7,11 @@
export LC_ALL=C
if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then
test/lint/commit-script-check.sh $TRAVIS_COMMIT_RANGE
# TRAVIS_BRANCH will be present in a Travis environment. For builds triggered
# by a pull request this is the name of the branch targeted by the pull request.
# https://docs.travis-ci.com/user/environment-variables/
COMMIT_RANGE="$TRAVIS_BRANCH..HEAD"
test/lint/commit-script-check.sh $COMMIT_RANGE
fi
# This only checks that the trees are pure subtrees, it is not doing a full

View File

@ -27,6 +27,7 @@ if [ -z "${COMMIT_RANGE}" ]; then
if [ -n "$1" ]; then
COMMIT_RANGE="HEAD~$1...HEAD"
else
# This assumes that the target branch of the pull request will be develop
MERGE_BASE=$(git merge-base HEAD develop)
COMMIT_RANGE="$MERGE_BASE..HEAD"
fi

View File

@ -26,7 +26,9 @@ if [ -z "${COMMIT_RANGE}" ]; then
if [ -n "$1" ]; then
COMMIT_RANGE="HEAD~$1...HEAD"
else
COMMIT_RANGE="HEAD"
# This assumes that the target branch of the pull request will be develop.
MERGE_BASE=$(git merge-base HEAD develop)
COMMIT_RANGE="$MERGE_BASE..HEAD"
fi
fi