Skip to content

explicitly set submodule.recurse to false, to avoid checkout commands recursing into submodules

What does this MR do?

Fixes a bug which caused gitlab-runner with git config submodule.recurse true to fail while checking out after fetching the changes of the remote repository into a clone already existing on the runner.

See #27825 for more details of the issue.

Why was this MR needed?

Because gitlab-runner should behave consistently when fetching changes to the repository, and we already have the

 func (b *AbstractShell) writeSubmoduleUpdateCmds(w ShellWriter, info common.ShellScriptInfo) 

for updating submodules if the GIT_SUBMODULE_STRATEGY indicates updating is required.

git submodule.recurse docs git-docs

What's the best way to test this MR?

  1. Set up a project with a submodule and pipeline definition.
  2. Set up a runner with git config --global submodule.recurse true
  3. Trigger an initial pipeline so that the runner clones the repository
  4. Commit in the submodule, then update the main repository's reference to the submodule in another commit
  5. Pipeline will trigger due to step 4, this time succeeding to git checkout -f -q <SHA-1>, because the checkout no longer recurses into the submodule as well

What are the relevant issue numbers?

#27825

Edited by Ciprian Daniel Petrisor

Merge request reports