git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Robert Dailey <rcdailey.lists@gmail.com>
Cc: Git <git@vger.kernel.org>, Stefan Beller <sbeller@google.com>
Subject: Re: Fetch on submodule update
Date: Mon, 6 Aug 2018 08:41:22 -0700	[thread overview]
Message-ID: <20180806154122.GB105466@aiede.svl.corp.google.com> (raw)
In-Reply-To: <CAHd499CFHUwpNdYp2sMjChi_WWzSihi5VRzLMQbKsGrKf_Ktcg@mail.gmail.com>

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).

Jonathan

  reply	other threads:[~2018-08-06 15:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-01 17:18 Fetch on submodule update Robert Dailey
2018-08-01 22:34 ` Jonathan Nieder
2018-08-02  6:08 ` Jonathan Nieder
2018-08-06 14:45   ` Robert Dailey
2018-08-06 15:41     ` Jonathan Nieder [this message]
2018-08-06 15:44       ` Robert Dailey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180806154122.GB105466@aiede.svl.corp.google.com \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=rcdailey.lists@gmail.com \
    --cc=sbeller@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).