git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: Stanislav <s.seletskiy@gmail.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: git clone --recursive should run git submodule update with flag --remote
Date: Wed, 11 Nov 2015 11:48:08 -0800	[thread overview]
Message-ID: <CAGZ79kbOyXm11uPCXcDJzKxbQzBx6ZOmq0TS8kc52xy-qV_FiQ@mail.gmail.com> (raw)
In-Reply-To: <loom.20151111T133121-436@post.gmane.org>

On Wed, Nov 11, 2015 at 4:46 AM, Stanislav <s.seletskiy@gmail.com> wrote:
> Consider two repositories, A and B.
>
> Repo A is embedded into B by using submodule:
>
>   git submodule add -b master <url-to-A> sub-a
>
> So, submodule sub-a is set to track master branch of the repo A.
>
> Running git submodule update --remote inside repo B will automatically
> update and checkout submodule sub-a to the latest master commit (as expected).
>
> However, when using git clone --recursive <url-to-B>, repo B will be cloned
> with submodule A checkouted to the commmit which was recorded on git
> submodule add command, not the master commit.
>
> Expected behaviour is to automatically update checkout commit pointed by
> branch, that was specified by -b flag in the git submodule add invocation.

To achieve what you want to do, you can first clone B and then
do a `git submodule update` using the --remote option yourself.
That is cumbersome however, I agree.

>
> Reason for this behaviour is that line:
>
>   https://github.com/git/git/blob/master/builtin/clone.c#L99
>
> I guess, it should be changed to include --remote flag.

I guess we could tweak the behavior to include the --remote flag
when the branch is recorded in the .gitmodules file.

Just wondering what should happen if there are both a sha1
and a branch recorded?

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

      reply	other threads:[~2015-11-11 19:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-11 12:46 git clone --recursive should run git submodule update with flag --remote Stanislav
2015-11-11 19:48 ` Stefan Beller [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=CAGZ79kbOyXm11uPCXcDJzKxbQzBx6ZOmq0TS8kc52xy-qV_FiQ@mail.gmail.com \
    --to=sbeller@google.com \
    --cc=git@vger.kernel.org \
    --cc=s.seletskiy@gmail.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).