git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Bug in git submodule update --depth

From
JRJesse Rittner <rittneje@gmail.com>
Date
Jul 29, 2022, 15:20 UTC
Message-ID
<CA+SRSSGkgLrmy0ATj+1OOL6=jR6J0SE+0Orbwh+=C5KcVp82kA@mail.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

Message 1 of 1 in “Bug in git submodule update --depth”
  1. Jesse RittnerJul 29, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.