aboutsummaryrefslogtreecommitdiff
path: root/dev/lint-repository.sh
diff options
context:
space:
mode:
authorEmilio Jesus Gallego Arias2018-12-27 09:16:21 +0100
committerEmilio Jesus Gallego Arias2018-12-27 09:16:21 +0100
commit721457e41db164057025f48a8a46596397c0c5c8 (patch)
tree10044730266bf752cf15f96be0803d4ed405501b /dev/lint-repository.sh
parent86fc5bbbd93f7e6c380bc3a9a4271fc83214264d (diff)
parentb80e0b73e4417f414d723cfb2f424ecec321767d (diff)
Merge PR #9224: Move lint job to gitlab
Diffstat (limited to 'dev/lint-repository.sh')
-rwxr-xr-xdev/lint-repository.sh28
1 files changed, 10 insertions, 18 deletions
diff --git a/dev/lint-repository.sh b/dev/lint-repository.sh
index cd09b6d305..f588c20d02 100755
--- a/dev/lint-repository.sh
+++ b/dev/lint-repository.sh
@@ -4,33 +4,25 @@
# lint-commits.sh seeks to prevent the worsening of already present
# problems, such as tab indentation in ml files. lint-repository.sh
-# seeks to prevent the (re-)introduction of solved problems, such as
-# newlines at the end of .v files.
+# also seeks to prevent the (re-)introduction of solved problems, such
+# as newlines at the end of .v files.
CODE=0
-if [ -n "${TRAVIS_PULL_REQUEST}" ] && [ "${TRAVIS_PULL_REQUEST}" != false ];
-then
- # skip PRs from before the linter existed
- if [ -z "$(git ls-tree --name-only "${TRAVIS_PULL_REQUEST_SHA}" dev/lint-commits.sh)" ];
- then
- 1>&2 echo "Linting skipped: pull request older than the linter."
- exit 0
- fi
-
- # Some problems are too widespread to fix in one commit, but we
- # can still check that they don't worsen.
- CUR_HEAD=${TRAVIS_COMMIT_RANGE%%...*}
- PR_HEAD=${TRAVIS_COMMIT_RANGE##*...}
- MERGE_BASE=$(git merge-base "$CUR_HEAD" "$PR_HEAD")
- dev/lint-commits.sh "$MERGE_BASE" "$PR_HEAD" || CODE=1
-fi
+# We assume that all 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)
+
+dev/lint-commits.sh "$base" "$head" || CODE=1
# Check that the files with 'whitespace' gitattribute end in a newline.
# xargs exit status is 123 if any file failed the test
+echo Checking end of file newlines
find . "(" -path ./.git -prune ")" -o -type f -print0 |
xargs -0 dev/tools/check-eof-newline.sh || CODE=1
+echo Checking overlays
dev/tools/check-overlays.sh || CODE=1
exit $CODE