Skip to content

Don't use depth for fetches

Nicki Křížek requested to merge nicki/dont-use-depth into main

Rely on the git repository depth it was cloned with (e.g. use GIT_DEPTH in .gitlab-ci.yml) rather than setting the depth. Using the depth option to deeper a shallow repository may result in "incomplete pack header" error from libgit2, depending on the initial depth, required depth and the contents of the commits in between.

The only reliable values appear to be either 0 (GIT_FETCH_DEPTH_FULL) or 2147483647 (GIT_FETCH_DEPTH_UNSHALLOW). It defaults to 0 and won't unshallow a repository, if there is a reachable commit already in the tree, which should be the case for our purposes, given the depth is sufficient (1000 proved to be suitable for our worklow).

Merge request reports