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

RE: git submodule update --remote fails on non-master branches with shallow clones enabled

From
MCMaxim Chuvilyaev <maxim.chuvilyaev@civica.com.au>
Date
May 24, 2017, 00:37 UTC
Message-ID
<0E82EDCE97D80143A03AE87B9DF4EB3A8A7E8CD7@Sydmail.civica.com.au>
Hi,

I am experiencing a problem with git submodules: git cannot update submodules from remote when using a non-master branch and shallow clones.

Tested git versions

client: 2.13 (Windows) server: 2.10 (CentOS 7)

Behaviour
when I have a submodule that is configured to get updates from a non-master branch and, at the same time, shallow clones are enabled, "git submodule update --remote" fails.
Example configuration in .gitmodules:
[submodule "webapi"]
               path = webapi
               url = ../../api/web-api.git
               branch = release/2.1
               shallow = true
               
The error message is:

fatal: Needed a single revision Unable to find current origin/release/2.1 revision in submodule path 'webapi'

I think that the cause of this problem is the following: When this submodule is initialised initially, in ".git/modules/webapi/config" I can see that fetch is configured this way:

fetch = +refs/heads/master:refs/remotes/origin/master
That's probably why git cannot find my release/2.1 branch. The question is - why this happens despite the submodule is explicitly configured to use a non-master branch in .gitmodules?... 

NB For the remote git, I enabled both uploadpack.allowReachableSHA1InWant & uploadpack.allowTipSHA1InWant.

Kind regards, Maxim

This e-mail and any attachment(s), is confidential and may be legally privileged. It is intended solely for the addressee. If you are not the addressee, dissemination, copying or use of this e-mail or any of its content is prohibited and may be unlawful. If you are not the intended recipient please inform the sender immediately and destroy the e-mail, any attachment(s) and any copies. All liability for viruses is excluded to the fullest extent permitted by law. It is your responsibility to scan or otherwise check this email and any attachment(s). Unless otherwise stated (i) views expressed in this message are those of the individual sender (ii) no contract may be construed by this e-mail. Emails may be monitored and you are taken to consent to this monitoring. Civica Pty Limited ABN 83 003 691 718 Incorporated in New South Wales

Message 1 of 1 in “RE: git submodule update --remote fails on non-master branches with shallow clones enabled”
  1. Maxim ChuvilyaevMay 24, 2017

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.