aboutsummaryrefslogtreecommitdiff
path: root/ci
diff options
context:
space:
mode:
authorJames O'Beirne <james.obeirne@pm.me>2023-01-18 09:48:14 -0500
committerJames O'Beirne <james.obeirne@pm.me>2023-01-18 09:48:14 -0500
commitb68e5a7feff3e93027e75da0cd9a590fef99aac1 (patch)
tree0b041a3ac7a8c7614286832a242ef5fecbe05581 /ci
parentdff7ed5732c01b3ba47ef9e9ddb687d073d7739d (diff)
downloadbitcoin-b68e5a7feff3e93027e75da0cd9a590fef99aac1.tar.xz
lint: specify the right commit range when running locally
When running lints on Cirrus, a special envvar is set ($CIRRUS_PR); emulate this when running linters locally by setting $LOCAL_BRANCH to any value.
Diffstat (limited to 'ci')
-rwxr-xr-xci/lint/06_script.sh6
-rwxr-xr-xci/lint/docker-entrypoint.sh2
2 files changed, 6 insertions, 2 deletions
diff --git a/ci/lint/06_script.sh b/ci/lint/06_script.sh
index c14d7473d3..fa28f6126c 100755
--- a/ci/lint/06_script.sh
+++ b/ci/lint/06_script.sh
@@ -6,7 +6,11 @@
export LC_ALL=C
-if [ -n "$CIRRUS_PR" ]; then
+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
COMMIT_RANGE="HEAD~..HEAD"
echo
git log --no-merges --oneline "$COMMIT_RANGE"
diff --git a/ci/lint/docker-entrypoint.sh b/ci/lint/docker-entrypoint.sh
index 6179dfe68b..3fdbbb0761 100755
--- a/ci/lint/docker-entrypoint.sh
+++ b/ci/lint/docker-entrypoint.sh
@@ -6,7 +6,7 @@ export LC_ALL=C
git config --global --add safe.directory /bitcoin
if [ -z "$1" ]; then
- bash -ic "./ci/lint/06_script.sh"
+ LOCAL_BRANCH=1 bash -ic "./ci/lint/06_script.sh"
else
exec "$@"
fi