Skip to content

Commit d415b72

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#26588: ci: Skip COMMIT_RANGE if no CIRRUS_PR
fad1c55 lint: Skip COMMIT_RANGE if no CIRRUS_PR (MarcoFalke) Pull request description: It doesn't make sense to run this for non-PRs, because: * There are known whitespace "violations" in previous commits, so the lint may fail * Once the changes are merged, it is too late to fix them up (force pushes are illegal) * It isn't possible to determine which commits to run on if there is no reference branch (target branch of the pull request) Moreover, the test fails on non-master: * https://github.com/bitcoin/bitcoin/runs/8664441400 Fix all issues by skipping it. ACKs for top commit: hebasto: ACK fad1c55, also tested in my personal Cirrus account. Tree-SHA512: be15f00e2b2a9069583833545883e0e5968a33d2455dad59e6fb47c1102b4dd16ef932e9ba945e29e9d941e6c17bd531a02c66b0491097801be6bda476875537
2 parents 8597260 + fad1c55 commit d415b72

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

ci/lint/06_script.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ export LC_ALL=C
99
GIT_HEAD=$(git rev-parse HEAD)
1010
if [ -n "$CIRRUS_PR" ]; then
1111
COMMIT_RANGE="${CIRRUS_BASE_SHA}..$GIT_HEAD"
12+
echo
13+
git log --no-merges --oneline "$COMMIT_RANGE"
14+
echo
1215
test/lint/commit-script-check.sh "$COMMIT_RANGE"
16+
else
17+
COMMIT_RANGE="SKIP_EMPTY_NOT_A_PR"
1318
fi
1419
export COMMIT_RANGE
1520

@@ -36,8 +41,3 @@ if [ "$CIRRUS_REPO_FULL_NAME" = "bitcoin/bitcoin" ] && [ "$CIRRUS_PR" = "" ] ; t
3641
${CI_RETRY_EXE} gpg --keyserver hkps://keys.openpgp.org --recv-keys "${KEYS[@]}" &&
3742
./contrib/verify-commits/verify-commits.py;
3843
fi
39-
40-
if [ -n "$COMMIT_RANGE" ]; then
41-
echo
42-
git log --no-merges --oneline "$COMMIT_RANGE"
43-
fi

test/lint/lint-git-commit-check.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ def main():
4646
commit_range = merge_base + "..HEAD"
4747
else:
4848
commit_range = os.getenv("COMMIT_RANGE")
49+
if commit_range == "SKIP_EMPTY_NOT_A_PR":
50+
sys.exit(0)
4951

5052
commit_hashes = check_output(["git", "log", commit_range, "--format=%H"], universal_newlines=True, encoding="utf8").splitlines()
5153

test/lint/lint-whitespace.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ def main():
9797
commit_range = merge_base + "..HEAD"
9898
else:
9999
commit_range = os.getenv("COMMIT_RANGE")
100+
if commit_range == "SKIP_EMPTY_NOT_A_PR":
101+
sys.exit(0)
100102

101103
whitespace_selection = []
102104
tab_selection = []

0 commit comments

Comments
 (0)