aboutsummaryrefslogtreecommitdiff
path: root/dev
diff options
context:
space:
mode:
authorGaëtan Gilbert2019-02-18 13:28:59 +0100
committerGaëtan Gilbert2019-02-18 13:29:35 +0100
commit136b61ae70113922330de032f005b4acb50bc800 (patch)
tree111924aea1a33edd65975b09bef1abdddc6eeca8 /dev
parentf8d6c322783577b31cf55f8b55568ac56104202b (diff)
Fix per-commit linting with bot merges
When the bot auto-merged the linter saw no commits to lint, eg https://gitlab.com/coq/coq/-/jobs/162893603 I'm pushing from a non-current master so we will see if this works.
Diffstat (limited to 'dev')
-rwxr-xr-xdev/lint-repository.sh13
1 files changed, 10 insertions, 3 deletions
diff --git a/dev/lint-repository.sh b/dev/lint-repository.sh
index f588c20d02..2e8a7455de 100755
--- a/dev/lint-repository.sh
+++ b/dev/lint-repository.sh
@@ -9,10 +9,17 @@
CODE=0
-# We assume that all merge commits are from the main branch
+if [[ $(git log -n 1 --pretty='format:%s') == "Bot merge"* ]]; then
+ # The FIRST parent of bot merges is from the PR, the second is
+ # current master
+ head=$(git rev-parse HEAD~)
+else
+ head=$(git rev-parse HEAD)
+fi
+
+# We assume that all non-bot merge commits are from the main branch
# For Coq it is extremely rare for this assumption to be broken
-read -r base < <(git log -n 1 --merges --pretty='format:%H')
-head=$(git rev-parse HEAD)
+read -r base < <(git log -n 1 --merges --pretty='format:%H' "$head")
dev/lint-commits.sh "$base" "$head" || CODE=1