# Bug in git submodule update --depth

1 messages from 2022-07-29 to 2022-07-29. Participants: Jesse Rittner.
Thread: https://gitlist.dev/t/58244

## Jesse Rittner, 2022-07-29 15:20

Subject: Bug in git submodule update --depth
Message-ID: <CA+SRSSGkgLrmy0ATj+1OOL6=jR6J0SE+0Orbwh+=C5KcVp82kA@mail.gmail.com>
URL: https://gitlist.dev/e/CA%2BSRSSGkgLrmy0ATj%2B1OOL6%3DjR6J0SE%2B0Orbwh%2B%3DC5KcVp82kA%40mail.gmail.com

```
We have a repository with a submodule. The submodule is on some fairly
old commit. Under git 2.27.0, the following worked without issue

`git submodule update --init --recursive --depth=1 [path]`

(This did a shallow clone of the specific submodule commit.)

However, in git 2.31.1, it fails. The same failure is observed in git
2.37.1. I am unsure when the bug was introduced.

git submodule update --init --recursive --depth=1 [submodule]
Submodule '[submodule]' (ssh://git@[redacted].git) registered for path
'[submodule]’
Cloning into '[repository]/[submodule]'...
remote: Total 0 (delta 0), reused 0 (delta 0)
remote: Total 0 (delta 0), reused 0 (delta 0)
fatal: bad object e6f1975700c8d6fec2c3812277e3260194cb5379
error: remote did not send all necessary objects
fatal: Fetched in submodule path '[submodule]', but it did not contain
e6f1975700c8d6fec2c3812277e3260194cb5379. Direct fetching of that
commit failed.

From testing, it seems that git is incorrectly doing a shallow clone
of the branch instead of the submodule commit.

Your assistance in this matter is greatly appreciated.

Thanks,
Jesse Rittner

```
