Trilarion / opensourcegames

Technical infos of open source games.
https://trilarion.github.io/opensourcegames/
Creative Commons Zero v1.0 Universal
684 stars 85 forks source link

While updating the repos do a recursive clone with Git #204

Open Trilarion opened 5 years ago

Trilarion commented 5 years ago

For example with endgame singularity (and others)

Trilarion commented 4 years ago

It's more difficult than thought.

git clone --mirror creates the bare repository that we store, but that does not allow to git submodule --init because of "git-submodule cannot be used without a working tree".

It's not even possible to get information about used submodules with a bare repository.

Trilarion commented 4 years ago

See also here: https://stackoverflow.com/questions/22484179/git-bare-repositories-and-submodules

.gitmodules is a file within the repository, you can't directly access it within a bare repo

It seems that the information about submodules is stored in the working tree, a bare repo cannot access that information.

Trilarion commented 4 years ago

We could go through the git repositories, create the working tree (at least temporary), do "submodule init", get the .gitmodules file out of it, parse it and then mirror the additional submodules. That way all the information is stored, even though one would still need to insert local URLs in the .gitmodule files if a completely local "submodule update" is desired.

Trilarion commented 4 years ago

It's less complicated than I thought. See Get submodule hash from bare repository.

With git show HEAD:.gitmodules one can get the list of submodules from a bare repository. We cannot do a recursive bare clone, but we can get the submodules list and mirror them as well.

Trilarion commented 4 years ago

I had some problems with repository URL resolutions. There are relative paths and also git@domain: notations or something just a ".". Otherwise it works now.

Will leave open until the name resolution works better.

Trilarion commented 4 years ago

Btw. it was definitely worth it. The approx. 1200 Git repos have ~550 unique, different submodules.

Trilarion commented 4 years ago

There were quite a few errors, my name resolution might not work well.