[Git][ghc/ghc][wip/mangoiv/clone-shallow-default] ci: make shallow cloning the default
Magnus pushed to branch wip/mangoiv/clone-shallow-default at Glasgow Haskell Compiler / GHC Commits: 4716b4f5 by mangoiv at 2026-11-25T16:43:32+01:00 ci: make shallow cloning the default We disabled shallow cloning because linters sometimes need deep clones. We now clone shallowly and just enable deep cloning on lint jobs that we know need them (see b2f106f5544e4c71bb07df4acb9d2b5ed184a7e3) Fixes #28157 - - - - - 2 changed files: - .gitlab-ci.yml - testsuite/driver/perf_notes.py Changes: ===================================== .gitlab-ci.yml ===================================== @@ -17,8 +17,7 @@ variables: # Bump to invalidate GitLab CI cache. CACHE_REV: 12 - # Disable shallow clones; they break our linting rules - GIT_DEPTH: 0 + GIT_DEPTH: 1 # Always start with a fresh clone to avoid non-hermetic builds GIT_STRATEGY: clone @@ -267,6 +266,7 @@ ghc-linters: extends: .lint-params variables: BUILD_FLAVOUR: default + GIT_DEPTH: 0 script: - .gitlab/ci.sh configure - timeout 10m .gitlab/ci.sh run_hadrian test --test-root-dirs="testsuite/tests/linters" @@ -282,7 +282,6 @@ lint-changelog: extends: .lint-ghc-toolchain variables: CHANGELOG_EXPECT_MR: "$CI_MERGE_REQUEST_IID" - GIT_DEPTH: 1 GIT_SUBMODULE_STRATEGY: none script: - .gitlab/ci.sh lint_changelog @@ -297,7 +296,6 @@ lint-changelog: lint-linters: extends: .lint-python variables: - GIT_DEPTH: 1 GIT_SUBMODULE_STRATEGY: none script: - mypy testsuite/tests/linters/regex-linters/*.py @@ -307,7 +305,6 @@ lint-linters: lint-testsuite: extends: .lint-ghc-toolchain variables: - GIT_DEPTH: 1 GIT_SUBMODULE_STRATEGY: none script: - make -Ctestsuite list_broken TEST_HC=$(which ghc) @@ -317,7 +314,6 @@ lint-testsuite: typecheck-testsuite: extends: .lint-python variables: - GIT_DEPTH: 1 GIT_SUBMODULE_STRATEGY: none script: - mypy testsuite/driver/runtests.py @@ -330,6 +326,7 @@ typecheck-testsuite: extends: .lint-params variables: BUILD_FLAVOUR: default + GIT_DEPTH: 0 GIT_SUBMODULE_DEPTH: 0 # full history script: - .gitlab/ci.sh configure @@ -346,6 +343,7 @@ typecheck-testsuite: lint-author: extends: .lint-python variables: + GIT_DEPTH: 0 GIT_SUBMODULE_STRATEGY: none script: - git fetch "$CI_MERGE_REQUEST_PROJECT_URL" $CI_MERGE_REQUEST_TARGET_BRANCH_NAME @@ -362,7 +360,6 @@ lint-ci-config: extends: .lint # We don't need history/submodules in this job variables: - GIT_DEPTH: 1 GIT_SUBMODULE_STRATEGY: none before_script: - echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf ===================================== testsuite/driver/perf_notes.py ===================================== @@ -433,6 +433,12 @@ def baseline_commit_log(commit: Union[GitHash,GitRef]) -> List[GitHash]: # including the input commit. The output commits are all commit hashes. # str -> [str] def commit_log(commitOrRange, n=None): + # default gitlab git cloning is shallow: for git perf notes we still need to be able + # to catch up on history. This unshallows the repository and fetches a blobless tree. + is_shallow = subprocess.check_output( ['git', 'rev-parse', '--is-shallow-repository']).decode().strip() == 'true' + if is_shallow: + subprocess.check_call(['git', 'fetch', '--unshallow', '--filter=blob:none', 'origin', '+refs/notes/*:refs/notes/*']) + nArgs = ['-n' + str(n)] if n != None else [] output = subprocess.check_output(['git', 'log', '--format=%H'] + nArgs + [commitOrRange]).decode() hashes = list(filter(is_commit_hash, output.split('\n'))) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4716b4f518a70b108adde8e0924e3eed... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4716b4f518a70b108adde8e0924e3eed... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Magnus (@MangoIV)