git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Jesper Rønn-Jensen" <jesperrr@gmail.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: Error fetching submodule from submodule
Date: Fri, 8 Mar 2019 09:50:15 +0100	[thread overview]
Message-ID: <CAL-rKu6knyzyVE7VuTRZEKoS9MOU8ip+Nm+HH7dJAOffb46q2w@mail.gmail.com> (raw)
In-Reply-To: <20190307180831.GA21404@sigill.intra.peff.net>

Thanks Jeff

You are completely right! It works as I expect if I remember the extra
parameter `--recursive` when doing `git submodule update --init
--recursive`

Thanks a lot for your feedback! This is really useful! I learned a
useful thing today :)

/Jesper

On Thu, Mar 7, 2019 at 7:08 PM Jeff King <peff@peff.net> wrote:
>
> On Thu, Mar 07, 2019 at 12:07:21PM +0100, Jesper Rønn-Jensen wrote:
>
> > Hi I think I may have found an error in the way git handles a
> > submodule's submodule. Read further for the example (extracted from a
> > real project).
>
> First off, thank you for the example script. It made understanding
> what's going on so much easier. :)
>
> > * I have a main repository which has some submodules defined.
> > * One of the submodules is a common submodule which is also included
> > in one of the other submodules
> > * When running `git fetch --recurse-submodules` I get an error.
>
> I think the presence of common_submodule in the main repo is actually a
> red herring. if you remove the last two lines of this stanza:
>
> > git setup main_repos
> > pushd main_repos
> > git submodule add ../common_submodule
> > git commit -m 'added submodule to main_repos'
>
> the outcome is the same.
>
> > # This line fails with error code 1 "Could not access submodule
> > 'common_submodule'"
> > git fetch --recurse-submodules
>
> It looks like "fetch" is smart enough to initialize a submodule when
> necessary, but not smart enough to do so recursively. If I replace that
> line with:
>
>   git submodule update --init --recursive
>
> then it works as I'd expect. Likewise, cloning the repository with:
>
>   git clone --recurse-submodules main_repos foo
>
> does what you'd want.
>
> After that, I think "git fetch --recurse-submodules" does what you want,
> because the submodule repository is already initialized.
>
> I'm not sure to what degree git-fetch intended to support initializing
> submodules. But it certainly seems like a bug that it handles the top
> layer but does not recurse (i.e., it should either handle all or none).
>
> Hopefully the commands above at least give you a workaround.
>
> -Peff



-- 

Jesper Rønn-Jensen
Nine A/S
Mobile: +45 2989 1822
Blog http://justaddwater.dk/
jesperrr@gmail.com (Private e-mail and Google Talk IM)

      reply	other threads:[~2019-03-08  8:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-07 11:07 Error fetching submodule from submodule Jesper Rønn-Jensen
2019-03-07 18:08 ` Jeff King
2019-03-08  8:50   ` Jesper Rønn-Jensen [this message]

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=CAL-rKu6knyzyVE7VuTRZEKoS9MOU8ip+Nm+HH7dJAOffb46q2w@mail.gmail.com \
    --to=jesperrr@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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).