summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-06-07 11:14:07 -0400
committerBen Gamari <ben@well-typed.com>2019-06-08 13:34:18 -0400
commitf58234ea75112b1569e860e6a864d66509df381a (patch)
treefbc2787929a29e187a9a4855df4b69c724c687bf /.gitlab-ci.yml
parentfe9653160be3b025698be9a2a2141b2b87b8ef55 (diff)
downloadhaskell-f58234ea75112b1569e860e6a864d66509df381a.tar.gz
gitlab-ci: Fix submodule linter
The job script didn't even try to compute the base commit to lint with respect to.
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r--.gitlab-ci.yml6
1 files changed, 6 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index fdb4174ddb..a67d45ec4c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -52,6 +52,8 @@ ghc-linters:
stage: lint
image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
script:
+ # Note [Unshallow clone for linting]
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# GitLab creates a shallow clone which means that we may not have the base
# commit of the MR being tested (e.g. if the MR is quite old), causing `git
# merge-base` to fail. Passing `--unshallow` to `git fetch` ensures that
@@ -78,6 +80,10 @@ ghc-linters:
stage: lint
image: "registry.gitlab.haskell.org/ghc/ci-images/linters:$DOCKER_REV"
script:
+ # See Note [Unshallow clone for linting]
+ - git fetch --unshallow "$CI_MERGE_REQUEST_PROJECT_URL" $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
+ - base="$(git merge-base FETCH_HEAD $CI_COMMIT_SHA)"
+ - "echo Linting changes between $base..$CI_COMMIT_SHA"
- submodchecker .git $(git rev-list $base..$CI_COMMIT_SHA)
dependencies: []
tags: