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

Re: Problem with --shallow-submodules option

From
Stefan Beller <sbeller@google.com>
Date
Jun 21, 2016, 20:35 UTC
Message-ID
<CAGZ79kYvMjDaPnet1J_QrHARYtNqLwRhs7f08cDZ7P6dT8Rs6A@mail.gmail.com>
In-Reply-To
<CAPV8XuZvDkcEwxRB0HwaihVo7QzqsoHTRCdV7sqxkT31-RWkmA@mail.gmail.com>
On Mon, Jun 20, 2016 at 11:32 PM, Istvan Zakar <istvan.zakar@gmail.com> wrote:
Show 8 quoted lines
> Hi,
>
> Thanks for the answer.
> So it means that it is a setting on the server side which can be
> activated? (I guess it depends on the version of the server)
> I did some reading in the topic. Are you talking about this setting
> "uploadpack.allowReachableSHA1InWant", or did I misunderstood what I
> read?
No that's exactly what I meant; sorry for not spelling that out.

Thanks, Stefan

Show 56 quoted lines
>
> Thanks,
>     Istvan
>
> On 20 June 2016 at 19:45, Stefan Beller <sbeller@google.com> wrote:
>> On Mon, Jun 20, 2016 at 6:06 AM, Istvan Zakar <istvan.zakar@gmail.com> wrote:
>>> Hello,
>>>
>>> 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).
>>
>> Yes that is broken as the depth of a submodule is counted from its own HEAD
>> not from the superprojects sha1 as it should.
>>
>> So it does
>>
>>     git clone --depth=1 <submodule-url> <submodule-path>
>>
>>     if HEAD != recorded gitlink sha1,
>>         git fetch <recorded gitlink sha1>
>>
>>     git checkout <recorded gitlink sha1>
>>
>>> Can I somehow tell to fetch that exact commit I need for my
>>> superproject?
>>
>> Some servers support fetching by direct sha1, which is what we make use
>> of here, then it sort-of works.
>>
>> If the server doesn't support the capability to fetch an arbitrary sha1,
>> the submodule command fails, with a message such as
>>
>>     error: no such remote ref $sha1
>>     Fetched in submodule path '<submodule>', but it did not contain
>> $sha1. Direct fetching of that commit failed.
>>
>> So if it breaks for you now, I would suggest not using that switch, I
>> don't think there is a quick
>> workaround.
>>
>>>
>>> Thanks,
>>>    Istvan
>>
>> Thanks,
>> Stefan
>>
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe git" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous: Istvan ZakarNext: Fredrik Gustafsson
Message 4 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.