diff options
author | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2024-03-15 15:00:13 +0100 |
---|---|---|
committer | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2024-03-21 20:15:08 +0100 |
commit | fa1146d01b148dd60fcada36a3b37ed37532ce2b (patch) | |
tree | b3727e9d63b3a1c805dc90ec908e3a03630ce4fe /ci/lint/06_script.sh | |
parent | 71b63195b30b2fa0dff20ebb262ce7566dd5d673 (diff) | |
download | bitcoin-fa1146d01b148dd60fcada36a3b37ed37532ce2b.tar.xz |
lint: Fix COMMIT_RANGE issues
Diffstat (limited to 'ci/lint/06_script.sh')
-rwxr-xr-x | ci/lint/06_script.sh | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/ci/lint/06_script.sh b/ci/lint/06_script.sh index 318b2bb819..cdf0f60147 100755 --- a/ci/lint/06_script.sh +++ b/ci/lint/06_script.sh @@ -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 |