Secret Detection fails with "error processing shallow info"

Summary

A customer was previously encountering the following error when using an older version of the Secret Detection job:

[WARN] [secrets] [2022-01-22T02:33:18Z] ▶ 2:33AM ERR fatal: bad revision '^..'

After switching to use our template for the job, the following error is encountered:

$ # we don't need the whole history when excluding in the next `git fetch` line, # collapsed multi-line command
From https://gitlab.com/[redacted]/[redacted]
 * branch            develop    -> FETCH_HEAD
 * [new branch]      develop    -> origin/develop
fatal: error processing shallow info: 4

This looks to be occurring on the git fetch --shallow-exclude line of the newest template here.

NOTE: This only seems to occur on the master branch for this specific repository. It should also be noted that the master branch is not the default branch, instead a branch named develop is.

Issue created via request in this thread.

What is the current bug behavior?

The job fails due to an issue related to the shallow clone before executing the analyzer.

What is the expected correct behavior?

The analyzer works as expected.

Possible fixes