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

Re: [PATCH] submodule: Fetch the direct sha1 first

From
Jens Lehmann <jens.lehmann@web.de>
Date
Feb 22, 2016, 19:22 UTC
Message-ID
<56CB5FDC.5050409@web.de>
In-Reply-To
<xmqqvb5k9r5g.fsf@gitster.mtv.corp.google.com>
Am 20.02.2016 um 01:11 schrieb Junio C Hamano:
Show 23 quoted lines
> Stefan Beller <sbeller@google.com> writes:
>
>> On Fri, Feb 19, 2016 at 2:29 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Stefan Beller <sbeller@google.com> writes:
>>>
>>>> Doing a 'git fetch' only and not the fetch for the specific sha1 would be
>>>> incorrect?
>>>
>>> I thought that was what you are attempting to address.
>>
>> Yep. In an ideal world I would imagine it would look like
>>
>>      if $sha1 doesn't exist:
>>          fetch $sha1
>>          if server did not support fetching direct sha1:
>>              fallback to fetch <no args>
>
> It should look more like this:
>
> 	if $sha1's history and objects are incomplete:
> 		fetch ;# normally just like we have done before
>                  if $sha1's history and objects are still incomplete:
> 			fetch $sha1

That makes lots of sense, doesn't break existing workflows and enables the use case Stefan described. And if people want to skip the first fetch later we could still add a config option to do so.

Show 6 quoted lines
> as existing users already expect that commits and objects that are
> reachable from tips of refs configured to be fetched in the
> submodule via its configured refspecs are available after this part
> of the code runs, regardless of this "Gerrit reviews may not have
> arrived to branches yet" issue.  The first "normal" fetch ensures
> that the expectation is met.

Not sure if that has come up so far, but I believe we should not only do that for the submodule command but also for a regular fetch when it is configured to fetch submodule commits too (which it is by default unless configured otherwise). Otherwise we'll lose the plane-safety fetch normally provides in case of these unconnected submodule sha1s, which would then again break users expectations.

And if we see demand for only fetching the sha1s without any extra history in the future (e.g. to minimize the amount of data to be fetched by a CI server), we could add a new value ("by-sha1" or such) for both the --recurse-submodules option of fetch and pull and the submodule.<name>.fetchRecurseSubmodules config setting. Then both a git submodule update and fetch would attempt to just fetch the sha1(s) needed without any fetching any extra history.

Previous: Junio C HamanoNext: Jacob Keller
Message 7 of 8 in “submodule: Fetch the direct sha1 first”
  1. submodule: Fetch the direct sha1 firstStefan Beller, Feb 19, 2016
  2. Junio C HamanoFeb 19, 2016
  3. Stefan BellerFeb 19, 2016
  4. Junio C HamanoFeb 19, 2016
  5. Stefan BellerFeb 19, 2016
  6. Junio C HamanoFeb 20, 2016
  7. Jens LehmannFeb 22, 2016
  8. Jacob KellerFeb 20, 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.