Synchronizing submodule url intermittently fails with “fatal: not a git repository” in CI
<!--IssueSummary start-->
<details>
<summary>
Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards.
</summary>
- [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=391756)
</details>
<!--IssueSummary end-->
### Summary
Intermittently, checking out the submodules for our project in one of our CI jobs fails, with the following [output](https://gitlab.gnome.org/pwithnall/glib/-/jobs/2586460):
```
Updating/initializing submodules...
Submodule 'subprojects/gvdb' (https://gitlab-ci-token:[MASKED]@gitlab.gnome.org/GNOME/gvdb.git) registered for path 'subprojects/gvdb'
Synchronizing submodule url for 'subprojects/gvdb'
fatal: not a git repository: subprojects/gvdb/../../.git/modules/subprojects/gvdb
```
Re-running that CI job succeeds. The problem happens maybe 1 in 10 CI runs, very roughly.
Relevant configuration:
* Project: https://gitlab.gnome.org/GNOME/glib
* [`.gitmodules`](https://gitlab.gnome.org/GNOME/glib/-/blob/main/.gitmodules)
- In particular, `url = ../../GNOME/gvdb.git` and `shallow = true`
- Which points to this repository: https://gitlab.gnome.org/GNOME/gvdb
* [`.gitlab-ci.yml`](https://gitlab.gnome.org/GNOME/glib/-/blob/40fc22f81ff2d269818d66817f471126ccc9f1cc/.gitlab-ci.yml#L75-84)
- In particular, `GIT_SUBMODULE_STRATEGY: "normal"` for this job
* This fork of the project had the git depth unset in the the CI/CD settings, but the main project has it set to `1`; I don’t think that makes a difference
Output from a [successful submodule fetch](https://gitlab.gnome.org/GNOME/glib/-/jobs/2581495):
```
Updating/initializing submodules with git depth set to 1...
Submodule 'subprojects/gvdb' (https://gitlab-ci-token:[MASKED]@gitlab.gnome.org/GNOME/gvdb.git) registered for path 'subprojects/gvdb'
Synchronizing submodule url for 'subprojects/gvdb'
Cloning into '/builds/GNOME/glib/subprojects/gvdb'...
Submodule path 'subprojects/gvdb': checked out '0854af0fdb6d527a8d1999835ac2c5059976c210'
Entering 'subprojects/gvdb'
Entering 'subprojects/gvdb'
```
### Steps to reproduce
Since it’s an intermittent issue and I don’t fully understand what’s causing it, I’m afraid I can’t give reproducer instructions, sorry.
### Example Project
https://gitlab.gnome.org/GNOME/glib/
Unfortunately it’s not on gitlab.com.
### What is the current *bug* behavior?
Submodule fetch intermittently fails.
### What is the expected *correct* behavior?
Submodule fetch works reliably.
#### Results of GitLab environment info
I don’t have immediate access to this, but can get specific information off our sysadmins if that would be helpful — just say what you need.
#### Results of GitLab application Check
Same
issue