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

Issue with git submodule update --init --depth=1 submodA

From
JDJared Davison <jared@medical-objects.com.au>
Date
Mar 23, 2016, 08:28 UTC
Message-ID
<CAECUmHo8Q=N_rTP7NnYaQJ24g9SVrgCmpq1NHVXe1icD6xn7vw@mail.gmail.com>
Hello all,
I have encountered a problem with using submodules.
The problem occurs when using
repo-parent$ git submodule update --init --depth=1 submodA

Submodule 'submoduleA' (.../submoduleA.git) registered for path 'submoduleA' Cloning into 'submoduleA'... Fetched in submodule path 'submoduleA', but it did not contain 8a1c22151b510160d7b41a019d7642ab2cd5e085. Direct fetching of that commit failed.

Note the --depth=1 argument.

This all works fine if the head of the submodA master branch is the revision required by the repo-parent as shown in "git submodule list"

However, if submodA's history has progressed by one commit, then --depth=2 is required and this works fine. --depth=1 will no longer work and gives the error as above.

Does depth always have to be counted from the head or most recent commit in the submodule branch?

Could depth be counted from the required commit reference by the parent repo instead of the most recent? If so then --depth=1 could work I think.

The reason I would like to do this is that the history actually contains some fairly large files and I wish to clone only the history for the current version of the files in that most recent commit. This all works great until someone pushes a commit into the submodule. I am using this as part of a continuous integration process which will build branches that reference submodules where the referenced commit may go back a long way back in history.

Trying to determine the correct depth parameter value to use is impossible as with time it will be a growing amount as commits are added to the submodule branch.

Another user found the same issue:  http://stackoverflow.com/a/25875273

I have just compiled the git from "next" branch source, "git version 2.8.0.rc4.233.g1aaf96d" and have confirmed this is still the behaviour.

Thanks for reading my enquiry and for your thoughts on this topic.
Jared
Next: Stefan Beller
Message 1 of 5 in “Issue with git submodule update --init --depth=1 submodA”
  1. Jared DavisonMar 23, 2016
  2. Stefan BellerMar 23, 2016
  3. Jared DavisonMar 24, 2016
  4. Jared DavisonMar 24, 2016
  5. Stefan BellerMar 24, 2016

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.