threads / discuss / 25999

how to have real (existing) submodules?

Subject: how to have real (existing) submodules?

## tl;dr

2 messages between Dec 8, 2010 and Dec 8, 2010.

replies: 1people: 2as markdown or json

Oliver Kullmann· Dec 8, 2010, 20:58 UTC · lore
Hi,
I have the following organisational problem:

Due to access restrictions, privacy, communication problems etc. I need to have independent git repositories for various projects (for example working on a scientific paper --- tossing the repos as tarballs around is really great, and it works also for those who do not want to use git). There repositories exist all at various locations, often just local repositories, without internet access (though some are on Github).

This creates obviously the problem of carrying them around (especially given that certain places don't have Internet connection, and data needs to be transferred via memory sticks).

I thought that "git submodule" would solve the problem, but now I realised that these submodules are not "real", but they only contain a bit of meta-data (this should really be said directly in the documentation).

So my hope, that I can have one super-repo, where I say, e.g., "git submodule foreach pull", get the full super-repo, copy it on a memory stick, and then by pulling from that copy I get everything into another super-repo, from which I distribute the sub-repos, seems not so easily realisable with git?

A major restriction of git seems that the url's of each sub-repo need to be unique, since they are in the global file .gitmodules? This seems strange to me: If every submodule had its repo-specific pull-information, then still by foreach-git-pull, where each pull has location-specific information, I could achieve something.

Hm, is the way how this is supposed to work really to first do "git submodule init", to get a false path to the sub-repo into config, and then to change that path? Then I have that nonsensic information about the url in .gitmodules? And I can't just push the whole thing to Github (as I would have hoped)? There is also the old problem that config is not under version control. So "submodule" would be just about substituting scripts which run through a bunch of repos and call, e.g., git pull in each (but with a certain commit in mind)?

Anyway, if that's how it is, please just tell me. (And perhaps the use-case is somehow convincing to a developer, and somebody might think about adding "full" submodules.)

Thanks in any case!
Oliver
Seth Robertson· Dec 8, 2010, 22:25 UTC · re: Oliver Kullmann · lore

Re: how to have real (existing) submodules?

In message <20101208205846.GW29789@cs-wsok.swansea.ac.uk>, Oliver Kullmann writ es:

    I thought that "git submodule" would solve the problem, but now I
    realised that these submodules are not "real", but they only
    contain a bit of meta-data (this should really be said directly in
    the documentation).
    So my hope, that I can have one super-repo, where I say, e.g.,
    "git submodule foreach pull", get the full super-repo, copy it on
    a memory stick, and then by pulling from that copy I get
    everything into another super-repo, from which I distribute the
    sub-repos, seems not so easily realisable with git?

gitslave may work for you better than git-submodules in this specific use case. http://gitslave.sf.net

In your example, you would create an organizational super-project git module which is primarily a container for the .gitslave file which tells the system how to access the various git repos and their on-disk path names.

Given your diverse repo locations, it sounds like you will not be using the feature which allows the pathnames of the slave repos to be relative based on the URL to the super-repo (though you could have a mixture of relative and absolute URLs if that would help your functionality).

You would then run `gits pull` to issue a `git pull` against every slave repo, and likewise `gits push` or `gits push home` or whatever. (remotes would best work if your gitslave system has relative URLs). While the super-project cannot be bare, the slave-repos could be bare if that would help your data transfer functionality.

If certain slave repos would not be accessible in all locations, there are options to bypass the errors you will get attempting to contact the unreachable repos.

If you have any questions, please let me know (here, private email, or on #git).

					-Seth Robertson

← back to recent threads