lint: Fix COMMIT_RANGE issues

This commit is contained in:
MarcoFalke
2024-03-15 15:00:13 +01:00
parent 71b63195b3
commit fa1146d01b
3 changed files with 19 additions and 29 deletions

View File

@@ -8,21 +8,24 @@ export LC_ALL=C
set -ex
if [ -n "$LOCAL_BRANCH" ]; then
# To faithfully recreate CI linting locally, specify all commits on the current
# branch.
COMMIT_RANGE="$(git merge-base HEAD master)..HEAD"
elif [ -n "$CIRRUS_PR" ]; then
if [ -n "$CIRRUS_PR" ]; then
COMMIT_RANGE="HEAD~..HEAD"
echo
git log --no-merges --oneline "$COMMIT_RANGE"
echo
test/lint/commit-script-check.sh "$COMMIT_RANGE"
if [ "$(git rev-list -1 HEAD)" != "$(git rev-list -1 --merges HEAD)" ]; then
echo "Error: The top commit must be a merge commit, usually the remote 'pull/${PR_NUMBER}/merge' branch."
false
fi
else
COMMIT_RANGE="SKIP_EMPTY_NOT_A_PR"
# Otherwise, assume that a merge commit exists. This merge commit is assumed
# to be the base, after which linting will be done. If the merge commit is
# HEAD, the range will be empty.
COMMIT_RANGE="$( git rev-list --max-count=1 --merges HEAD )..HEAD"
fi
export COMMIT_RANGE
echo
git log --no-merges --oneline "$COMMIT_RANGE"
echo
test/lint/commit-script-check.sh "$COMMIT_RANGE"
RUST_BACKTRACE=1 "${LINT_RUNNER_PATH}/test_runner"
if [ "$CIRRUS_REPO_FULL_NAME" = "bitcoin/bitcoin" ] && [ "$CIRRUS_PR" = "" ] ; then

View File

@@ -14,7 +14,7 @@ export PATH="/python_build/bin:${PATH}"
export LINT_RUNNER_PATH="/lint_test_runner"
if [ -z "$1" ]; then
LOCAL_BRANCH=1 bash -ic "./ci/lint/06_script.sh"
bash -ic "./ci/lint/06_script.sh"
else
exec "$@"
fi