{"thread":{"id":"46035","subject":"RE: git submodule update --remote fails on non-master branches with shallow clones enabled","startedAt":"2017-05-24T00:38:04Z","lastAt":"2017-05-24T00:38:04Z","messageCount":1,"participants":["Maxim Chuvilyaev"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"320607","messageId":"0E82EDCE97D80143A03AE87B9DF4EB3A8A7E8CD7@Sydmail.civica.com.au","threadId":"46035","inReplyTo":null,"subject":"RE: git submodule update --remote fails on non-master branches with shallow clones enabled","fromName":"Maxim Chuvilyaev","fromEmail":"maxim.chuvilyaev@civica.com.au","sentAt":"2017-05-24T00:37:53Z","receivedAt":"2017-05-24T00:38:04Z","isPatch":false,"sender":{"key":"maxim.chuvilyaev@civica.com.au","avatar":null},"body":"Hi,\n\nI am experiencing a problem with git submodules:\ngit cannot update submodules from remote when using a non-master branch and shallow clones.\n\nTested git versions\n\nclient: 2.13 (Windows)\nserver: 2.10 (CentOS 7)\n\nBehaviour\n\nwhen 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.\n\nExample configuration in .gitmodules:\n\n[submodule \"webapi\"]\n               path = webapi\n               url = ../../api/web-api.git\n               branch = release/2.1\n               shallow = true\n               \nThe error message is:\n\nfatal: Needed a single revision\nUnable to find current origin/release/2.1 revision in submodule path 'webapi'\n\nI think that the cause of this problem is the following:\nWhen this submodule is initialised initially, in \".git/modules/webapi/config\" I can see that fetch is configured this way:\n\nfetch = +refs/heads/master:refs/remotes/origin/master\n\nThat'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?... \n\nNB \nFor the remote git, I enabled both uploadpack.allowReachableSHA1InWant & uploadpack.allowTipSHA1InWant.\n\nKind regards,\nMaxim\n\n\nThis 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.\nCivica Pty Limited  ABN 83 003 691 718    Incorporated in New South Wales\n"}]}