Skip to content

Commit b68e5a7

Browse files
committed
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.
1 parent dff7ed5 commit b68e5a7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

ci/lint/06_script.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66

77
export LC_ALL=C
88

9-
if [ -n "$CIRRUS_PR" ]; then
9+
if [ -n "$LOCAL_BRANCH" ]; then
10+
# To faithfully recreate CI linting locally, specify all commits on the current
11+
# branch.
12+
COMMIT_RANGE="$(git merge-base HEAD master)..HEAD"
13+
elif [ -n "$CIRRUS_PR" ]; then
1014
COMMIT_RANGE="HEAD~..HEAD"
1115
echo
1216
git log --no-merges --oneline "$COMMIT_RANGE"

ci/lint/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export LC_ALL=C
66
git config --global --add safe.directory /bitcoin
77

88
if [ -z "$1" ]; then
9-
bash -ic "./ci/lint/06_script.sh"
9+
LOCAL_BRANCH=1 bash -ic "./ci/lint/06_script.sh"
1010
else
1111
exec "$@"
1212
fi

0 commit comments

Comments
 (0)