Submodule relative URL problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

I am currently working on a project, call it A, which contains several sub-projects B, C, D.  The B, C, D are actually experimental input and outputs for simulation runs, which I need to keep track of the daily changes.  Most of these calculations are done on workstation, but I do need to occasionally clone the repositories to other machines, and then push the updates back.

I version track B, C and D with independent git repositories, and organisationally it makes sense for them to be subdirectories of A.  I would like to version control the overall project A, with B, C, D as submodules.

This is easily done on the main workstation (I will call it W1), with:

cd A
git init
for ii in B C D ; do
  git submodule ./${ii}/.git
done
git add .
git commit

Repository A/.git on W1 does not have an origin.  All seems to work fine with this step up on W1.

HOWEVER, problem starts to appear when I attempted to clone the overall repository A to another workstation W2:

git clone W1:<path to A on W1>/.git  <path to A on W2>
cd <path to A on W2>
git submodule init
git submodule update

git then produces an error indicating that:

W1:<path to A on W1>/.git/B/.git

is not a valid repository (i.e. directory not found)

The extra .git has been inserted in the URL to submodule repository B, C, and D.

This can be solved by changing the .gitmodules file, replacing ./B/.git to ../B/.git,  and then git submodule sync on W2.

However, this is far from being an optimal solution, because if .gitmodules on W1 is updated accordingly, then the submodule repository for B would point to

<path to A on W1>/../B/.git

which will be incorrect.  I could in principle define the URL for the submodule repositories as absolute paths, but keeping them relative to A has many advantages, such as I will be able to move A around, without effecting the main repositories on W1 in anyway, and I can rsync them to another disk for backup etc.

I would be very grateful if someone can offer me an solution to my problem.

Many thanks in advance!

Lianheng

================================================
Lianheng Tong                                    Tel: +44 79 1758 3822  
Room S4.02, Strand Building           Fax: +44 20 7848 2420  
Department of Physics                       lianheng.tong@xxxxxxxxx
Kings College London                                  
Strand, London WC2R 2LS, U.K.                         
================================================--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]