{"thread":{"id":"58244","subject":"Bug in git submodule update --depth","startedAt":"2022-07-29T15:22:23Z","lastAt":"2022-07-29T15:22:23Z","messageCount":1,"participants":["Jesse Rittner"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"460222","messageId":"CA+SRSSGkgLrmy0ATj+1OOL6=jR6J0SE+0Orbwh+=C5KcVp82kA@mail.gmail.com","threadId":"58244","inReplyTo":null,"subject":"Bug in git submodule update --depth","fromName":"Jesse Rittner","fromEmail":"rittneje@gmail.com","sentAt":"2022-07-29T15:20:53Z","receivedAt":"2022-07-29T15:22:23Z","isPatch":false,"sender":{"key":"rittneje@gmail.com","avatar":null},"body":"We have a repository with a submodule. The submodule is on some fairly\nold commit. Under git 2.27.0, the following worked without issue\n\n`git submodule update --init --recursive --depth=1 [path]`\n\n(This did a shallow clone of the specific submodule commit.)\n\nHowever, in git 2.31.1, it fails. The same failure is observed in git\n2.37.1. I am unsure when the bug was introduced.\n\ngit submodule update --init --recursive --depth=1 [submodule]\nSubmodule '[submodule]' (ssh://git@[redacted].git) registered for path\n'[submodule]’\nCloning into '[repository]/[submodule]'...\nremote: Total 0 (delta 0), reused 0 (delta 0)\nremote: Total 0 (delta 0), reused 0 (delta 0)\nfatal: bad object e6f1975700c8d6fec2c3812277e3260194cb5379\nerror: remote did not send all necessary objects\nfatal: Fetched in submodule path '[submodule]', but it did not contain\ne6f1975700c8d6fec2c3812277e3260194cb5379. Direct fetching of that\ncommit failed.\n\nFrom testing, it seems that git is incorrectly doing a shallow clone\nof the branch instead of the submodule commit.\n\nYour assistance in this matter is greatly appreciated.\n\nThanks,\nJesse Rittner\n"}]}