git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Randall S. Becker" <rsbecker@nexbridge.com>
To: "'Stefan Beller'" <sbeller@google.com>
Cc: "'Ciro Santilli'" <ciro.santilli@gmail.com>, <git@vger.kernel.org>
Subject: RE: Add an option to automatically submodule update on checkout
Date: Mon, 8 May 2017 13:05:16 -0400	[thread overview]
Message-ID: <002301d2c81d$4728aae0$d57a00a0$@nexbridge.com> (raw)
In-Reply-To: <CAGZ79kbxdXhhG3+4v9qH_oDi5o_zseGsQf8KCyTN3+axZB9sUA@mail.gmail.com>

On May 8, 2017 12:55 PM, Stefan Beller wrote:
>On Mon, May 8, 2017 at 9:46 AM, Randall S. Becker <rsbecker@nexbridge.com> wrote:
>> On May 8, 2017 12:25 PM, Stefan Beller wrote:
>>>On Mon, May 8, 2017 at 7:42 AM, Randall S. Becker <rsbecker@nexbridge.com> wrote:
>>>> On May 6, 2017 4:38 AM Ciro Santilli wrote:
>>>>> This is a must if you are working with submodules, otherwise every 
>>>>> git checkout requires a git submodule update, and you forget it, 
>>>>> and things break, and you understand, and you go to stack overflow 
>>>>> questions 
>>>>> http://stackoverflow.com/questions/22328053/why-doesnt-git-checkout
>>>>> -a utomatically-do-git-submodule-update-recursive
>>>>> http://stackoverflow.com/questions/4611512/is-there-a-way-to-make-g
>>>>> it -pull-automatically-update-submodules
>>>>> and you give up and create aliases :-)
>>
>>> The upcoming release (2.13) will have "git checkout 
>>> --recurse-submodules", which will checkout the submodules at the commit as recorded in the superproject.
>>> I plan to add an option "submodule.recurse" (name is subject to 
>>> bikeshedding), which would make the --recurse-submodules flag given 
>>> by default for all commands that support the flag. (Currently cooking we have reset --recurse-submodules, already existing there is push/pull).
>>
>> Brilliant! 😊
>>
>>>> I rather like the concept of supporting --recurse-submodules. The complexity is that the branches in all submodules all have to have compatible >>>semantics when doing the checkout, which is by no means guaranteed. In the scenario where you are including a submodule from a third-party (very >>>common - see gnulib), the branches likely won't be there, so you have a high probability of having the command fail or produce the same results as >>>currently exists if you allow the checkout even with problems (another option?). If you have control of everything, then this makes sense.
>>
>>>I am trying to give the use case of having control over everything (or rather mixed) more thought as well, e.g. "checkout --recurse-submodules -b >><name>" may want to create the branches in a subset of submodules as well.
>>
>> I have to admit that I just assumed it would have to work that way 
>> this would not be particularly useful. However, in thinking about it, 
>> we might want to limit the depth of how far -b <name> takes effect. If 
>> the super module brings in submodules entirely within control of the 
>> development group, having -b <name> apply down to leaf submodules 
>> makes sense (in some policies). However, if some submodules span out 
>> to, say, gnulib, that might not make particular sense. Some downward 
>> limit might be appropriate. Perhaps, in the submodule ref, you might 
>> want to qualify it as <commit>:<ref> (but the impact of that is 
>> probably and admittedly pretty horrid). I hesitate to suggest a 
>> numeric limit, as that assumes that submodules are organized in a 
>> balanced tree - which is axiomatically unreasonable. Maybe something 
>> in .git/config, like
>>
>> [branch "topic*"]
>>         submodules=a,b,c
>>
>> But I suspect that would make things even more confusing.

>I thought about having yet-another-flag in the .gitmodules file, which states if the submodule is extern or internal.

>[submodule "gnulib"]
>    path=./gnulib
>    external = true # implies no branch for checkout -b --recurse-submodules

>I think there are a couple more situations where such "external" submodules are treated differently, so maybe we'd want to think carefully about the >actual name as different workflows would want to have different features for an internal/external submodule.

I didn't want to open up that one, but yes. That makes sense. However, I don't like overloading what "external" means or might mean in the future. Would you consider a distinct Boolean for that, like inherit-branch=true?

Cheers,
Randall


  reply	other threads:[~2017-05-08 17:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-06  8:37 Add an option to automatically submodule update on checkout Ciro Santilli
2017-05-08 14:42 ` Randall S. Becker
2017-05-08 16:25   ` Stefan Beller
2017-05-08 16:46     ` Randall S. Becker
2017-05-08 16:54       ` Stefan Beller
2017-05-08 17:05         ` Randall S. Becker [this message]
2017-05-08 17:08           ` Brandon Williams
2017-05-08 17:15             ` Stefan Beller
2017-05-09  2:58       ` Junio C Hamano
2017-05-09 13:00         ` Randall S. Becker
2017-05-08 16:48     ` Brandon Williams

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='002301d2c81d$4728aae0$d57a00a0$@nexbridge.com' \
    --to=rsbecker@nexbridge.com \
    --cc=ciro.santilli@gmail.com \
    --cc=git@vger.kernel.org \
    --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).