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

Re: Problem with --shallow-submodules option

From
Fredrik Gustafsson <iveqy@iveqy.com>
Date
Jun 22, 2016, 15:31 UTC
Message-ID
<20160622153145.GB16644@paksenarrion.iveqy.com>
In-Reply-To
<loom.20160620T145755-931@post.gmane.org>
On Mon, Jun 20, 2016 at 01:06:39PM +0000, Istvan Zakar wrote:
Show 7 quoted lines
> I'm working on a relatively big project with many submodules. During 
> cloning for testing I tried to decrease the amount of data need to be 
> fetched from the server by using --shallow-submodules option in the clone 
> command. It seems to check out the tip of the remote repo, and if it's not 
> the commit registered in the superproject the submodule update fails 
> (obviously). Can I somehow tell to fetch that exact commit I need for my 
> superproject?

Maybe. http://stackoverflow.com/questions/2144406/git-shallow-submodules gives a good overview of this problem.

git fetches a branch and is shallow from that branch, which might be an other sha1 than the one the submodule points to, (as you say). This is/was one of the drawbacks with this method. However the since git 2.8, git will try to fetch the sha1 direct (and not the branch). So then it will work, if(!), the server supports direct access to sha1. This was previously not allowed due to security concerns (if I recall correctly).

So the answer is, yes this will work if you've a recent version of git and support on the server side for doing this. Unfortunately I'm not sure which git version is needed on the server side for this to work.

-- 
Fredrik Gustafsson

phone: +46 733-608274
e-mail: iveqy@iveqy.com
website: http://www.iveqy.com
Previous: Stefan BellerNext: Istvan Zakar
Message 5 of 8 in “Problem with --shallow-submodules option”
  1. Istvan ZakarJun 20, 2016
  2. Stefan BellerJun 20, 2016
  3. Istvan ZakarJun 21, 2016
  4. Stefan BellerJun 21, 2016
  5. Fredrik GustafssonJun 22, 2016
  6. Istvan ZakarJun 30, 2016
  7. Stefan BellerJun 30, 2016
  8. Istvan ZakarJun 30, 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.