git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitlab-ci: fix "check" jobs with large merge requests

From
Patrick Steinhardt <ps@pks.im>
Date
Oct 16, 2026, 14:48 UTC
Message-ID
<20261016-pks-ci-optional-whitespace-job-v1-1-f5693fbae1a5@pks.im>

The "check-whitespace" and "check-style" jobs verify that the changes proposed by a merge request don't introduce whitespace errors or style violations. To do so, both of them compare against the base commit of the merge request.

But both GitHub and GitLab use shallow clones to set up the repository in CI jobs by default. So if the base commit to compare against is beyond the shallow boundary then these checks will fail. To avoid that error we thus configure GitHub CI to disable shallow clones via `fetch-depth: 0`. But we don't do the equivalent for GitLab, so we see such errors whenever we have a merge request with more than 50 commits, which is the configured shallowness for gitlab-org/git.

Fix these issues by setting GIT_DEPTH to 0 for both jobs so that we always fetch the full history.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
Hi,

one more day, one more CI annoyance. The "check-whitespace" job is somewhat broken for us in case we have MRs that have more than 50 commits. And while that's not something that happens for patch series that we send upstream, it does happen for some of our internal development branches.

See [1] for a pipeline run with these changes.
Thanks!
Patrick
[1]: https://gitlab.com/gitlab-org/git/-/merge_requests/703
---
 .gitlab-ci.yml | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3f24835500..62737279d2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -256,6 +256,8 @@ check-whitespace:
   image: ubuntu:latest
   stage: analyze
   needs: [ ]
+  variables:
+    GIT_DEPTH: 0
   before_script:
     - ./ci/install-dependencies.sh
   # Since $CI_MERGE_REQUEST_TARGET_BRANCH_SHA is only defined for merged
@@ -276,6 +278,7 @@ check-style:
   variables:
     CC: clang
     jobname: ClangFormat
+    GIT_DEPTH: 0
   before_script:
     - ./ci/install-dependencies.sh
   # Since $CI_MERGE_REQUEST_TARGET_BRANCH_SHA is only defined for merged

---
base-commit: f57c9a73884400380bddd172acc88b569834f909
change-id: 20261016-pks-ci-optional-whitespace-job-ff1effc3fec7
Next: Junio C Hamano
Message 1 of 6 in “gitlab-ci: fix "check" jobs with large merge requests”
  1. gitlab-ci: fix "check" jobs with large merge requestsPatrick Steinhardt, Oct 16, 2026
  2. Junio C HamanoOct 16, 2026
  3. Patrick SteinhardtOct 19, 2026
  4. Karthik NayakOct 19, 2026
  5. Junio C HamanoOct 19, 2026
  6. Patrick SteinhardtOct 20, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.