Custom executor fails when .git folder is corrupt "missing blob object"

Hi all,

I'm running a custom executor on a lustre file system which deletes unused files after 30 days. This is a quite standard setup in HPC centers.

Every now and then files from the builds/txUXd4Wq/{id}/{path}/{to}/{repo}/.git/ are automatically deleted, corrupting the git repository.

The output from gitlab-runner is as follows:

Reinitialized existing Git repository in /scratch/path/to/builds/txUXd4Wq/{id}/{path}/{to}/{repo}/.git/
fatal: missing blob object '53978e5317fc07c199936d272fe81bccaebb339b'

and CI fails.

Would it be possible to force a fresh git checkout whenever git cannot properly reinitialize the repo?