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

Re: Fetch on submodule update

From
RDRobert Dailey <rcdailey.lists@gmail.com>
Date
Aug 6, 2018, 15:44 UTC
Message-ID
<CAHd499AcgCNfZtthwsqiki7JKrDTmMzq48z12H5Mf+mLKrf_QA@mail.gmail.com>
In-Reply-To
<20180806154122.GB105466@aiede.svl.corp.google.com>
On Mon, Aug 6, 2018 at 10:41 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 32 quoted lines
> Robert Dailey wrote:
>
>>                                                  Automatic would be
>> great if submodules were treated as integrated in a similar manner to
>> subtree, but it's not there. I wasn't aware that `submodule update`
>> did a fetch, because sometimes if I do that, I get errors saying SHA1
>> is not present (because the submodule did not get fetched). Granted I
>> haven't seen this in a while, so maybe the fetch on submodule update
>> is a newer feature. Do you know what triggers the fetch on update
>> without --remote? Is it the missing SHA1 that triggers it, or is it
>> fetching unconditionally?
>
> Thanks for this and the rest of the context you sent.  It's very
> helpful.
>
> The relevant code in git-submodule.sh is
>
>         # Run fetch only if $sha1 isn't present or it
>         # is not reachable from a ref.
>         is_tip_reachable "$sm_path" "$sha1" ||
>         fetch_in_submodule "$sm_path" $depth ||
>         say "$(eval_gettext "Unable to fetch in submodule path '\$displaypath'")"
>
>         # Now we tried the usual fetch, but $sha1 may
>         # not be reachable from any of the refs
>         is_tip_reachable "$sm_path" "$sha1" ||
>         fetch_in_submodule "$sm_path" $depth "$sha1" ||
>         die "$(eval_gettext "Fetched in submodule path '\$displaypath', but it did not contain \$sha1. Direct fetching of that commit failed.")"
>
> The fallback to fetching by SHA-1 was introduced in v2.8.0-rc0~9^2
> (submodule: try harder to fetch needed sha1 by direct fetching sha1,
> 2018-02-23).

Yep, that's the root cause; I was basing my concerns on a legacy issue. I just had avoided using `update` when I expected a fetch, so I never saw the issue again, and thus didn't realize it was corrected. Very helpful. Thanks again!

Previous: Jonathan Nieder
Message 6 of 6 in “Fetch on submodule update”
  1. Robert DaileyAug 1, 2018
  2. Jonathan NiederAug 1, 2018
  3. Jonathan NiederAug 2, 2018
  4. Robert DaileyAug 6, 2018
  5. Jonathan NiederAug 6, 2018
  6. Robert DaileyAug 6, 2018

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.