{"thread":{"id":"10996","subject":"cloning submodules with children submodules","startedAt":"2007-11-23T19:17:15Z","lastAt":"2007-11-23T20:35:38Z","messageCount":3,"participants":["Paul Martinolich","Sven Verdoolaege"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"60781","messageId":"BC1DE15A-9225-41D3-A2D7-21A14DF81048@nrlssc.navy.mil","threadId":"10996","inReplyTo":null,"subject":"cloning submodules with children submodules","fromName":"Paul Martinolich","fromEmail":"martinol@nrlssc.navy.mil","sentAt":"2007-11-23T19:17:15Z","receivedAt":"2007-11-23T19:17:15Z","isPatch":false,"sender":{"key":"martinol@nrlssc.navy.mil","avatar":null},"body":"It appears that git clone or git submodule init does not handle  \nsubmodules under submodules.\n\nGiven this project tree:\n\nmodules/mod_A\nmodules/mod_B\nmodules/mod_b\n\nproj_one/mod_A\nproj_one/mod_B\nproj_one/mod_B/mod_b\n\nproj_two/mod_A\nproj_two/mod_B\nproj_two/mod_b\n\nThe cloning of proj_two works correctly.  However, for proj_one, mod_b  \nis not under mod_B:\n\ncloned proj_one\n\n$ ls -a ./\n.  ..  .git  .gitmodules  mod_A  mod_B\tproject.txt\n$ ls -a ./mod_A\n.  ..\n$ ls -a ./mod_B\n.  ..\n$ more .gitmodules\n[submodule \"mod_A\"]\n\tpath = mod_A\n\turl = /home/martinol/test/modules/mod_A/.git\n[submodule \"mod_B\"]\n\tpath = mod_B\n\turl = /home/martinol/test/modules/mod_B/.git\nSubmodule 'mod_A' (/home/martinol/test/modules/mod_A/.git) registered  \nfor path 'mod_A'\nSubmodule 'mod_B' (/home/martinol/test/modules/mod_B/.git) registered  \nfor path 'mod_B'\nInitialized empty Git repository in /home/martinol/test/user_a/ \nproj_one/mod_A/.git/\n0 blocks\nSubmodule path 'mod_A': checked out  \n'80298817a0789d039e1fb4a73c9635fce8e7cdd2'\nInitialized empty Git repository in /home/martinol/test/user_a/ \nproj_one/mod_B/.git/\n0 blocks\nSubmodule path 'mod_B': checked out  \n'21b652610f5e9085f799c424d8a7ef685f5ec440'\n\nsubmodule init/update proj_one\n\n$ ls -a ./\n.  ..  .git  .gitmodules  mod_A  mod_B\tproject.txt\n$ ls -a ./mod_A\n.  ..  .git  module.txt\n$ ls -a ./mod_B\n.  ..  .git  module.txt\n$ more .gitmodules\n[submodule \"mod_A\"]\n\tpath = mod_A\n\turl = /home/martinol/test/modules/mod_A/.git\n[submodule \"mod_B\"]\n\tpath = mod_B\n\turl = /home/martinol/test/modules/mod_B/.git\n\npublic proj_one\n\n$ cd ~/test/proj_one\n$ ls -a ./\n.  ..  .git  .gitmodules  mod_A  mod_B\tproject.txt\n$ ls -a ./mod_B\n.  ..  .git  .gitmodules  mod_b  module.txt\n$ more .gitmodules\n[submodule \"mod_A\"]\n\tpath = mod_A\n\turl = /home/martinol/test/modules/mod_A/.git\n[submodule \"mod_B\"]\n\tpath = mod_B\n\turl = /home/martinol/test/modules/mod_B/.git\n$ more mod_B/.gitmodules\n[submodule \"mod_b\"]\n\tpath = mod_b\n\turl = /home/martinol/test/modules/mod_b/.git\n\n$ git --version\ngit version 1.5.3.6\n\nI've attached a script that demonstrates this behavior.\n\nThanks, Paul\n\n\n\n\n\n\n\n"},{"id":"60783","messageId":"20071123194904.GL2261MdfPADPa@greensroom.kotnet.org","threadId":"10996","inReplyTo":"BC1DE15A-9225-41D3-A2D7-21A14DF81048@nrlssc.navy.mil","subject":"Re: cloning submodules with children submodules","fromName":"Sven Verdoolaege","fromEmail":"skimo@kotnet.org","sentAt":"2007-11-23T19:49:04Z","receivedAt":"2007-11-23T19:49:04Z","isPatch":false,"sender":{"key":"skimo@kotnet.org","avatar":null},"body":"On Fri, Nov 23, 2007 at 01:17:15PM -0600, Paul Martinolich wrote:\n> It appears that git clone or git submodule init does not handle  \n> submodules under submodules.\n\nI don't see why it wouldn't work.\n\nYou seem to think, however, that git submodule update would\ncall git submodule update/init inside any submodules it clones.\nIt doesn't.\n\n> The cloning of proj_two works correctly.  However, for proj_one, mod_b  \n> is not under mod_B:\n\nYou didn't commit the change to mod_B to proj_one.\nFurthermore, you didn't push your changes to mod_B to\nthe repo you specified for mod_B in .gitmodules.\n\nskimo\n"},{"id":"60787","messageId":"383F62AA-096E-4D8E-BCE8-B2B87507C596@nrlssc.navy.mil","threadId":"10996","inReplyTo":"20071123194904.GL2261MdfPADPa@greensroom.kotnet.org","subject":"Re: cloning submodules with children submodules","fromName":"Paul Martinolich","fromEmail":"martinol@nrlssc.navy.mil","sentAt":"2007-11-23T20:35:38Z","receivedAt":"2007-11-23T20:35:38Z","isPatch":false,"sender":{"key":"martinol@nrlssc.navy.mil","avatar":null},"body":"\nOn Nov 23, 2007, at 1:49 PM, Sven Verdoolaege wrote:\n\n> You didn't commit the change to mod_B to proj_one.\n> Furthermore, you didn't push your changes to mod_B to\n> the repo you specified for mod_B in .gitmodules.\n\nThanks for the help.\n\nIt works with the changes below.\n\nPaul\n\nI changed the creation of mod_b under mod_B to:\n\n#  add mod_b to mod_B and push the changes back to mod_B\n\ncd $GITDIR/proj_one/mod_B\ngit submodule add $GITDIR/modules/mod_b\ngit commit -m 'add module mod_b under module mod_B for project proj_one'\ngit push\n\ncd $GITDIR/proj_one\ngit add mod_B\ngit commit -m 'reflect module mod_B update for project proj_one'\ngit status\n\nand when I cloned it to:\n\n#  clone the proj_one project (user user_a)\n\nmkdir -p $GITDIR/user_a\ncd $GITDIR/user_a\ngit clone $GITDIR/proj_one\ncd $GITDIR/user_a/proj_one\n\n#  get mod_A and mod_B\n\ngit submodule init\ngit submodule update\n\n#  now get mod_b in mod_B\n\ncd mod_B\ngit submodule init\ngit submodule update\n"}]}