Skip to content

GIT_DEPTH=0 does not work as expected, it does not unshallow git history

Hello folks,

Unfortunately, GIT_DEPTH=0 does not deliver what is meant to be done.

If you have the default setting for an early stage (i.e. build), then the next Job, although with specified GIT_DEPTH: 0 variable, won't get the full depth. The repository will still be shallowed. You can run cat .git/shallow to verify this.

The only work-around I found was to add - git fetch --unshallow origin +refs/heads/*:refs/remotes/origin/* before the script runs.

This is particularly annoying for linting/quality check tasks, such as with SonarQube.

It would be great to fix the behaviour behind the variable directly