git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* submodule network operations [WAS: Re: [RFC/PATCH 0/4] working tree operations: support superprefix]
@ 2017-01-13 18:30 Stefan Beller
  2017-01-15 21:02 ` Brian J. Davis
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Beller @ 2017-01-13 18:30 UTC (permalink / raw)
  To: Brian J. Davis; +Cc: Brandon Williams, git@vger.kernel.org, David Turner

This question is about networking; the patch you originally replied to
was strictly about local operations in the filesystem, which is quite
a difference, so let's discuss it separately.

On Fri, Jan 13, 2017 at 9:56 AM, Brian J. Davis <bitminer@gmail.com> wrote:
>
> In response to a post at:
>
> https://groups.google.com/forum/#!topic/git-users/BVLcKHhSUKo
>
> I was asked to post here to explain a potential problem with current modules
> implementation.  Apologies if I am posting in the wrong place... so good bad
> or otherwise here goes:
>
> +-------------------------------
> With:
>
> git push origin branchname
>
> or
>
> git push server2 branchname
>
> I can push or pull from multiple servers so no problem as git supports this.
>
> Now the problem with use of submodules
>
> submodules are listed:
>
> submodule.directory_to_
> checkout/proj1_dir.url=https://git.someserver1/git/proj1_dir
> <https://git.someserver1/git/proj1_dir>

Technically it is submodule.<name>.url instead of
submodule.<path>.url. The name is usually the path initially, and once
you move the submodule, only the path changes, the name is supposed to
be constant and stay the same.

>
>
> but if say I want to pull from some server 2 and do a
>
> git submodule update --init --recursive

That is why the "git submodule init" exists at all.

    git submodule init
    $EDIT .git/config # change submodule.<name>.url to server2
    git submodule update # that uses the adapted url and
    # creates the submodule repository.

    # From now on the submodule is on its own.
    cd <submodule> && git config --list
    # prints an "origin" remote and a lot more

For a better explanation, I started a documentation series, see
https://github.com/gitster/git/commit/e2b51b9df618ceeff7c4ec044e20f5ce9a87241e

(It is not finished, but that is supposed to explain this exact pain
point in the
STATES section, feel free to point out missing things or what is hard
to understand)

>
> what I would get is from someserver1 not someserver2 as there is no "origin"
> support for submodules.  Is this correct?  If so can origin support be added
> to submodules?

Can you explain more in detail what you mean by origin support?

> +-------------------------------
>
> So above was post from google group.  Maybe above is enough to explain the
> problem that can result, but if not here is a discussion as to why this can
> be confusing resulting to pushing or pulling from the incorrect server.
>
> Lets say projects starts at origin on https://server0.org. Project is then
> brought in house to server https://indhouse.corp by developer A.
>
> Developer A then changes the submodule projects to point to indhouse and
> changes submodules in super project to point to indhouse so everything is
> great.
>
> Then Developer B clones from indhouse makes changes to submodule1 and
> submodule1 and pushes them to indhouse.  Dev A tells Dev B hey thoes changes
> are great why don't you push to public server0 so every one can get thoes
> changes.  Dev B then git push origin branch_name on submodule1 and push
> origin on submodule 2 and superproject.  And everything is great ... right?
>
> Yes by now those who know git know what dev B  forgot or more to the point
> what git does not support in a "clean" way.  For those who don't enter the
> life of dev C
>
> So dev C clones from server0 and performs a git submodule update --init
> --recursive.  Now Dev C is on the www and can't see indhouse.corp and ...
> kerpow... Dev B and Dev C just experienced one of the many SW mines on the
> battlefield.
>
> I ask that git devs first see if I am correct with this assessment as I
> could be wrong... maybe there is a way of doing this... and if not add a
> feature to git to handle submodules and multiple origins cleanly.... and yes
> beating dev B with rubber chicken might be a solution though I am looking
> for a slightly better option.

Yes this is a big point that we want to solve eventually.

When devA brought it inhouse, what they meant to do was this:
"This superproject is actually from server0, but we want to work on it, which
may have submodules diverge from server0 eventually. So if a submodule changed
you need to get it from the inhouse server, otherwise fall back to the server0".

That way developerB can just make changes to some submodules and when
devC clones
they get the "correct" submodule.

A weak attempt to do this is to use *relative* submodule urls. When
using relative urls, and then mirroring the supeproject inhouse, then
Git will look for the submodules as well inhouse, but there
is no such "or if not found look at the original superprojects
origin", which means, you have to mirror all submodules.

And then about upstreaming changes. If you have a single repo (no
submodules), you have to teach people to run "git remote add remote
server0.org && git push upstream ...", but that you can do for each
submodule. (This is tedious:/ but maybe ok; some submodules are free
to sent things upstream whereas others are supersecret that you do not
want to push upstream ever.)

So yeah maybe we want to have more power in the superprojects push operation

    (in the superproject) $ git push --recurse-submodules \
       --only-these-submodules=subA,subB \
       --submodule-to=upstream-as-configered-in-super-project

This is a lot of words but for explaining that is ok?

Thanks,
Stefan

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-01-25  7:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13 18:30 submodule network operations [WAS: Re: [RFC/PATCH 0/4] working tree operations: support superprefix] Stefan Beller
2017-01-15 21:02 ` Brian J. Davis
2017-01-17 18:43   ` Stefan Beller
2017-01-19 23:11     ` Brian J. Davis
2017-01-20  1:22       ` Stefan Beller
2017-01-21 15:53         ` Brian J. Davis
2017-01-24 18:49           ` Stefan Beller
2017-01-25  7:14             ` Brian J. Davis

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