{"thread":{"id":"32543","subject":"Moving (renaming) submodules, recipe/script","startedAt":"2013-01-07T00:36:03Z","lastAt":"2013-01-08T17:48:57Z","messageCount":11,"participants":["W. Trevor King","Jonathan Nieder","Jens Lehmann","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"206193","messageId":"20130107003603.GA25698@odin.tremily.us","threadId":"32543","inReplyTo":null,"subject":"Moving (renaming) submodules, recipe/script","fromName":"W. Trevor King","fromEmail":"wking@tremily.us","sentAt":"2013-01-07T00:36:03Z","receivedAt":"2013-01-07T00:36:03Z","isPatch":false,"sender":{"key":"wking@tremily.us","avatar":"https://avatars.githubusercontent.com/u/209920?v=4"},"body":"Today I had to move my first submodule, and I discovered that Git's\nsupport for this is pretty limited.  There have been a few patch\nseries attempting to address this [1,2], but none of them seems to\nhave pushed through into master (although I can't put my finger on a\nreason for why).  There are also some SO postings discussing this\n[3,4].  It would be nice if `git mv` worked out of the box on\nsubmodules.  Failing that, there could be a `git submodule mv` command\nthat casts the appropriate spell.  Failing that, there could be a\nrecipe in Documentation/git-submodule.txt.  Here's the best I could\ncome up with for a `git-submodule-mv.sh`:\n\n  #!/bin/sh\n  # usage: git-submodule-mv.sh OLD NEW\n  OLD=$(realpath --relative-to . \"$1\")\n  NEW=$(realpath --relative-to . \"$2\")\n  SHA=$(git ls-files -s \"$OLD\" | sed 's|^[0-9]* \\([0-9a-f]*\\) .*|\\1|')\n  NAME=$(git config -f .gitmodules --get-regexp 'submodule\\..*\\.path' \"$OLD\" |\n    sed -e 's|^submodule.||' -e \"s|.path $OLD\\$||\")\n  GITDIR=$(realpath --relative-to \"$NEW\" .git/modules/\"$NAME\")\n  git config -f .gitmodules submodule.\"$NAME\".path \"$NEW\"\n  git config -f .git/modules/\"$NAME\"/config core.worktree \"../../../$NEW\"\n  git rm --cached \"$OLD\"\n  mv \"$OLD\" \"$NEW\"\n  echo \"gitdir: $GITDIR\" > \"$NEW/.git\"\n  git update-index --add --cacheinfo 160000 \"$SHA\" \"$NEW\"\n\nThis only works from the repository root directory, and I'm sure makes\na number of poor assumptions (e.g. old-style submodules that don't use\n`gitdir` links are not supported).  It does work for some simple test\ncases.  The tricky parts (e.g. path -> name conversion) are already\nworked out more robustly git-submodule.sh, so adding a new cmd_mv\nshouldn't be very difficult.\n\nCould something like this live somewhere in Git, or are we waiting for\na more integrated solution?\n\nCheers,\nTrevor\n\n[1]: http://thread.gmane.org/gmane.comp.version-control.git/88720\n[2]: http://thread.gmane.org/gmane.comp.version-control.git/143250\n[4]: http://stackoverflow.com/questions/4323558/moving-submodules-with-git\n[3]: http://stackoverflow.com/questions/4604486/how-do-i-move-an-existing-git-submodule-within-a-git-repository\n\n-- \nThis email may be signed or encrypted with GnuPG (http://www.gnupg.org).\nFor more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy\n"},{"id":"206196","messageId":"20130107013952.GE3823@elie.Belkin","threadId":"32543","inReplyTo":"20130107003603.GA25698@odin.tremily.us","subject":"Re: Moving (renaming) submodules, recipe/script","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-01-07T01:39:52Z","receivedAt":"2013-01-07T01:39:52Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"(just cc-ing Jens and Peter, who might be interested)\n\nW. Trevor King wrote:\n\n> Today I had to move my first submodule, and I discovered that Git's\n> support for this is pretty limited.  There have been a few patch\n> series attempting to address this [1,2], but none of them seems to\n> have pushed through into master (although I can't put my finger on a\n> reason for why).  There are also some SO postings discussing this\n> [3,4].  It would be nice if `git mv` worked out of the box on\n> submodules.  Failing that, there could be a `git submodule mv` command\n> that casts the appropriate spell.  Failing that, there could be a\n> recipe in Documentation/git-submodule.txt.  Here's the best I could\n> come up with for a `git-submodule-mv.sh`:\n>\n>   #!/bin/sh\n>   # usage: git-submodule-mv.sh OLD NEW\n>   OLD=$(realpath --relative-to . \"$1\")\n>   NEW=$(realpath --relative-to . \"$2\")\n>   SHA=$(git ls-files -s \"$OLD\" | sed 's|^[0-9]* \\([0-9a-f]*\\) .*|\\1|')\n>   NAME=$(git config -f .gitmodules --get-regexp 'submodule\\..*\\.path' \"$OLD\" |\n>     sed -e 's|^submodule.||' -e \"s|.path $OLD\\$||\")\n>   GITDIR=$(realpath --relative-to \"$NEW\" .git/modules/\"$NAME\")\n>   git config -f .gitmodules submodule.\"$NAME\".path \"$NEW\"\n>   git config -f .git/modules/\"$NAME\"/config core.worktree \"../../../$NEW\"\n>   git rm --cached \"$OLD\"\n>   mv \"$OLD\" \"$NEW\"\n>   echo \"gitdir: $GITDIR\" > \"$NEW/.git\"\n>   git update-index --add --cacheinfo 160000 \"$SHA\" \"$NEW\"\n>\n> This only works from the repository root directory, and I'm sure makes\n> a number of poor assumptions (e.g. old-style submodules that don't use\n> `gitdir` links are not supported).  It does work for some simple test\n> cases.  The tricky parts (e.g. path -> name conversion) are already\n> worked out more robustly git-submodule.sh, so adding a new cmd_mv\n> shouldn't be very difficult.\n>\n> Could something like this live somewhere in Git, or are we waiting for\n> a more integrated solution?\n>\n> Cheers,\n> Trevor\n>\n> [1]: http://thread.gmane.org/gmane.comp.version-control.git/88720\n> [2]: http://thread.gmane.org/gmane.comp.version-control.git/143250\n> [4]: http://stackoverflow.com/questions/4323558/moving-submodules-with-git\n> [3]: http://stackoverflow.com/questions/4604486/how-do-i-move-an-existing-git-submodule-within-a-git-repository\n"},{"id":"206211","messageId":"50EA7269.1080006@web.de","threadId":"32543","inReplyTo":"20130107013952.GE3823@elie.Belkin","subject":"Re: Moving (renaming) submodules, recipe/script","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2013-01-07T06:59:53Z","receivedAt":"2013-01-07T06:59:53Z","isPatch":false,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 07.01.2013 02:39, schrieb Jonathan Nieder:\n> (just cc-ing Jens and Peter, who might be interested)\n\nI´m currently working on teaching mv to move submodules and intend\nto send those patches to the list after finishing submodule deinit.\nPlease see\n  https://github.com/jlehmann/git-submod-enhancements/commits/mv-submodules\nfor the current state of this series.\n\n> W. Trevor King wrote:\n> \n>> Today I had to move my first submodule, and I discovered that Git's\n>> support for this is pretty limited.  There have been a few patch\n>> series attempting to address this [1,2], but none of them seems to\n>> have pushed through into master (although I can't put my finger on a\n>> reason for why).  There are also some SO postings discussing this\n>> [3,4].  It would be nice if `git mv` worked out of the box on\n>> submodules.  Failing that, there could be a `git submodule mv` command\n>> that casts the appropriate spell.  Failing that, there could be a\n>> recipe in Documentation/git-submodule.txt.  Here's the best I could\n>> come up with for a `git-submodule-mv.sh`:\n>>\n>>   #!/bin/sh\n>>   # usage: git-submodule-mv.sh OLD NEW\n>>   OLD=$(realpath --relative-to . \"$1\")\n>>   NEW=$(realpath --relative-to . \"$2\")\n>>   SHA=$(git ls-files -s \"$OLD\" | sed 's|^[0-9]* \\([0-9a-f]*\\) .*|\\1|')\n>>   NAME=$(git config -f .gitmodules --get-regexp 'submodule\\..*\\.path' \"$OLD\" |\n>>     sed -e 's|^submodule.||' -e \"s|.path $OLD\\$||\")\n>>   GITDIR=$(realpath --relative-to \"$NEW\" .git/modules/\"$NAME\")\n>>   git config -f .gitmodules submodule.\"$NAME\".path \"$NEW\"\n>>   git config -f .git/modules/\"$NAME\"/config core.worktree \"../../../$NEW\"\n>>   git rm --cached \"$OLD\"\n>>   mv \"$OLD\" \"$NEW\"\n>>   echo \"gitdir: $GITDIR\" > \"$NEW/.git\"\n>>   git update-index --add --cacheinfo 160000 \"$SHA\" \"$NEW\"\n>>\n>> This only works from the repository root directory, and I'm sure makes\n>> a number of poor assumptions (e.g. old-style submodules that don't use\n>> `gitdir` links are not supported).  It does work for some simple test\n>> cases.  The tricky parts (e.g. path -> name conversion) are already\n>> worked out more robustly git-submodule.sh, so adding a new cmd_mv\n>> shouldn't be very difficult.\n>>\n>> Could something like this live somewhere in Git, or are we waiting for\n>> a more integrated solution?\n>>\n>> Cheers,\n>> Trevor\n>>\n>> [1]: http://thread.gmane.org/gmane.comp.version-control.git/88720\n>> [2]: http://thread.gmane.org/gmane.comp.version-control.git/143250\n>> [4]: http://stackoverflow.com/questions/4323558/moving-submodules-with-git\n>> [3]: http://stackoverflow.com/questions/4604486/how-do-i-move-an-existing-git-submodule-within-a-git-repository\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n> \n"},{"id":"206213","messageId":"7vwqvpjv2n.fsf@alter.siamese.dyndns.org","threadId":"32543","inReplyTo":"50EA7269.1080006@web.de","subject":"Re: Moving (renaming) submodules, recipe/script","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-07T07:44:48Z","receivedAt":"2013-01-07T07:44:48Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jens Lehmann <Jens.Lehmann@web.de> writes:\n\n> Am 07.01.2013 02:39, schrieb Jonathan Nieder:\n>> (just cc-ing Jens and Peter, who might be interested)\n>\n> I´m currently working on teaching mv to move submodules and intend\n> to send those patches to the list after finishing submodule deinit.\n\nThanks for a heads-up.\n\nAs a couple of recent \"What's cooking\" message has stated, I'll\nshortly kick jl/submodule-deinit topic out of 'next' back to 'pu',\nso please make an update a replacement, not an incremental.  If I\nrecall the discussion correctly, I think we agreed that deinit\nshould clear the slate, which means the submodule working tree\nshould be removed and made into an empty directory without \".git\" in\nit, and the last round we saw on the list didn't do that.\n\nThanks.\n"},{"id":"206215","messageId":"50EA84E9.9030702@web.de","threadId":"32543","inReplyTo":"7vwqvpjv2n.fsf@alter.siamese.dyndns.org","subject":"Re: Moving (renaming) submodules, recipe/script","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2013-01-07T08:18:49Z","receivedAt":"2013-01-07T08:18:49Z","isPatch":false,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 07.01.2013 08:44, schrieb Junio C Hamano:\n> Jens Lehmann <Jens.Lehmann@web.de> writes:\n> \n>> Am 07.01.2013 02:39, schrieb Jonathan Nieder:\n>>> (just cc-ing Jens and Peter, who might be interested)\n>>\n>> I´m currently working on teaching mv to move submodules and intend\n>> to send those patches to the list after finishing submodule deinit.\n> \n> Thanks for a heads-up.\n> \n> As a couple of recent \"What's cooking\" message has stated, I'll\n> shortly kick jl/submodule-deinit topic out of 'next' back to 'pu',\n> so please make an update a replacement, not an incremental.  If I\n> recall the discussion correctly, I think we agreed that deinit\n> should clear the slate, which means the submodule working tree\n> should be removed and made into an empty directory without \".git\" in\n> it, and the last round we saw on the list didn't do that.\n\nRight, and me thinks that would warrant a --force option for deinit\nto do that even if the submodule contains local changes (which would\nmake deinit fail otherwise). Additionally Michael and Marc spoke up\nthat they would rather have a --all option to deinit all initialized\nsubmodules and \"git submodule deinit\" without any arguments should\njust produce a usage message. As I saw no voices against it that'll\nbe part of the next iteration too.\n"},{"id":"206223","messageId":"20130107120848.GA28559@odin.tremily.us","threadId":"32543","inReplyTo":"50EA7269.1080006@web.de","subject":"Re: Moving (renaming) submodules, recipe/script","fromName":"W. Trevor King","fromEmail":"wking@tremily.us","sentAt":"2013-01-07T12:08:48Z","receivedAt":"2013-01-07T12:08:48Z","isPatch":false,"sender":{"key":"wking@tremily.us","avatar":"https://avatars.githubusercontent.com/u/209920?v=4"},"body":"On Mon, Jan 07, 2013 at 07:59:53AM +0100, Jens Lehmann wrote:\n> I´m currently working on teaching mv to move submodules and intend\n> to send those patches to the list after finishing submodule deinit.\n> Please see\n>   https://github.com/jlehmann/git-submod-enhancements/commits/mv-submodules\n> for the current state of this series.\n\nAh, that will be much better :).\n\nIt looks like my script tries to do all the right things though, so if\nanyone needs to move a submodule before Jens' branch lands, you might\nwant to give it a try.\n\nCheers,\nTrevor\n\n-- \nThis email may be signed or encrypted with GnuPG (http://www.gnupg.org).\nFor more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy\n"},{"id":"206231","messageId":"7vlic5j7qm.fsf@alter.siamese.dyndns.org","threadId":"32543","inReplyTo":"50EA84E9.9030702@web.de","subject":"Re: Moving (renaming) submodules, recipe/script","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-07T16:08:49Z","receivedAt":"2013-01-07T16:08:49Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jens Lehmann <Jens.Lehmann@web.de> writes:\n\n> Right, and me thinks that would warrant a --force option for deinit\n> to do that even if the submodule contains local changes (which would\n> make deinit fail otherwise).\n\nProbably.\n\n> Additionally Michael and Marc spoke up\n> that they would rather have a --all option to deinit all initialized\n> submodules and \"git submodule deinit\" without any arguments should\n> just produce a usage message. As I saw no voices against it that'll\n> be part of the next iteration too.\n\nYeah, I forgot about that possible surprise of deiniting everything\nunder the sun by default.\n\nI am not sure if \"--all\" is a good way forward, though.\n\nCan you defeat it with \"git submodule deinit ./--all\" or something\nto limit the target only to one submodule whose unfortunate location\nis named as such?  If you have such a support, I have this suspicion\nthat you already get a short and explicit way to say \"everything\nunder the current directory\" with \"git submodule deinit .\" for free.\n"},{"id":"206295","messageId":"20130108143214.GA3755@odin.tremily.us","threadId":"32543","inReplyTo":"50EA7269.1080006@web.de","subject":"Re: Moving (renaming) submodules, recipe/script","fromName":"W. Trevor King","fromEmail":"wking@tremily.us","sentAt":"2013-01-08T14:32:14Z","receivedAt":"2013-01-08T14:32:14Z","isPatch":false,"sender":{"key":"wking@tremily.us","avatar":"https://avatars.githubusercontent.com/u/209920?v=4"},"body":"On Mon, Jan 07, 2013 at 07:59:53AM +0100, Jens Lehmann wrote:\n> Am 07.01.2013 02:39, schrieb Jonathan Nieder:\n> > (just cc-ing Jens and Peter, who might be interested)\n> \n> I´m currently working on teaching mv to move submodules and intend\n> to send those patches to the list after finishing submodule deinit.\n> Please see\n>   https://github.com/jlehmann/git-submod-enhancements/commits/mv-submodules\n> for the current state of this series.\n\nThinking about this a bit more, I'm not clear on how out-of-tree\nupdates (i.e. worktree in .git/modules/*/config) propogated during\nbranch checkouts (merges, rebases, etc.).  I just got a broken rebase\ntrying to move a trivial patch back before the submodule move, and Git\nwas confused about what had happened to the submodules.  Here's a\nsimple script that illustrates the problem:\n\n  #!/bin/sh\n  rm -rf a b c\n  mkdir a\n  (cd a\n   git init\n   echo a > README\n   git add README\n   git commit -am 'a'\n  )\n  git clone a b\n  (cd b\n   git submodule add ../a submod-1\n   git commit -am 'add submodule at submod-1'\n  )\n  git clone b c\n  (cd c\n   git submodule update --init\n  )\n  (cd b\n   git-submodule-mv.sh submod-1 submod-2\n   git commit -am 'move submodule from submod-1 to submod-2'\n  )\n  (cd c\n   git pull\n   ls -d .git/modules/*\n   cat .git/modules/submod-1/config\n   ls -a submod*\n  )\n\nThe end result is that `c` gets the `.gitmodules` path updates and new\ngitlinked directory from the submodule move in `b` (using my\ngit-submodule-mv.sh posted earlier in this thread), but `submod-1` is\nleft lying around (because Git doesn't know that it can remove\nsubmod-1/.git and submod-1/README).  The Git directory for the\nsubmodule stays in .git/modules/submod-1/ (good), but the worktree in\n.git/modules/submod-1/config still points to ../../../submod-1 (bad).\n\nThis means that submodule moves are possible, but anyone trying to\nshare them between several repositories (or trying to rebase across\nthe move within their own repository) is in for a world of suffering\n;).  I'm not sure how this should be addressed, but I didn't see\nanything handling it in Jens' new series.\n\nThanks,\nTrevor\n\n-- \nThis email may be signed or encrypted with GnuPG (http://www.gnupg.org).\nFor more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy\n"},{"id":"206299","messageId":"20130108155932.GB4662@odin.tremily.us","threadId":"32543","inReplyTo":"20130108143214.GA3755@odin.tremily.us","subject":"Re: Moving (renaming) submodules, recipe/script","fromName":"W. Trevor King","fromEmail":"wking@tremily.us","sentAt":"2013-01-08T15:59:32Z","receivedAt":"2013-01-08T15:59:32Z","isPatch":false,"sender":{"key":"wking@tremily.us","avatar":"https://avatars.githubusercontent.com/u/209920?v=4"},"body":"On Tue, Jan 08, 2013 at 09:32:14AM -0500, W. Trevor King wrote:\n> Thinking about this a bit more, I'm not clear on how out-of-tree\n> updates (i.e. worktree in .git/modules/*/config) propogated during\n> branch checkouts (merges, rebases, etc.).\n\nActually, I don't understand why storing `worktree` in\n.git/modules/*/config is useful at all….  This may be related to my\nlack of clarity on the \"why can't we have multiple working directories\nchecked out at the same time\" issue:\n\nOn Tue, Oct 23, 2012 at 06:09:55PM -0400, W. Trevor King wrote:\n> On Tue, Oct 23, 2012 at 10:57:57PM +0200, Jens Lehmann wrote:\n> > Am 22.10.2012 14:37, schrieb W. Trevor King:\n> > > but cloning a remote repository (vs. checking out a local branch)\n> > > seems to be baked into the submodule implementation.  Should I be\n> > > thinking about generalizing git-submodule.sh, or am I looking under\n> > > the wrong rock?  My ideal syntax would be something like\n> > > \n> > >   $ git submodule add -b c --local dir-for-c/\n> > \n> > But then we'd have to be able to have two (or more) work trees using\n> > the same git directory, which current submodule code can't.\n> \n> And that's the problem I'm trying to solve ;).\n\nCan someone with a better feeling for why this won't work.  Is is just\nthat there's only one `.git/HEAD`?\n\nCheers,\nTrevor\n\n-- \nThis email may be signed or encrypted with GnuPG (http://www.gnupg.org).\nFor more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy\n"},{"id":"206303","messageId":"50EC536D.8050606@web.de","threadId":"32543","inReplyTo":"20130108143214.GA3755@odin.tremily.us","subject":"Re: Moving (renaming) submodules, recipe/script","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2013-01-08T17:12:13Z","receivedAt":"2013-01-08T17:12:13Z","isPatch":false,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 08.01.2013 15:32, schrieb W. Trevor King:\n> On Mon, Jan 07, 2013 at 07:59:53AM +0100, Jens Lehmann wrote:\n>> Am 07.01.2013 02:39, schrieb Jonathan Nieder:\n>>> (just cc-ing Jens and Peter, who might be interested)\n>>\n>> I´m currently working on teaching mv to move submodules and intend\n>> to send those patches to the list after finishing submodule deinit.\n>> Please see\n>>   https://github.com/jlehmann/git-submod-enhancements/commits/mv-submodules\n>> for the current state of this series.\n> \n> Thinking about this a bit more, I'm not clear on how out-of-tree\n> updates (i.e. worktree in .git/modules/*/config) propogated during\n> branch checkouts (merges, rebases, etc.).  I just got a broken rebase\n> trying to move a trivial patch back before the submodule move, and Git\n> was confused about what had happened to the submodules.  Here's a\n> simple script that illustrates the problem:\n> \n>   #!/bin/sh\n>   rm -rf a b c\n>   mkdir a\n>   (cd a\n>    git init\n>    echo a > README\n>    git add README\n>    git commit -am 'a'\n>   )\n>   git clone a b\n>   (cd b\n>    git submodule add ../a submod-1\n>    git commit -am 'add submodule at submod-1'\n>   )\n>   git clone b c\n>   (cd c\n>    git submodule update --init\n>   )\n>   (cd b\n>    git-submodule-mv.sh submod-1 submod-2\n>    git commit -am 'move submodule from submod-1 to submod-2'\n>   )\n>   (cd c\n>    git pull\n>    ls -d .git/modules/*\n>    cat .git/modules/submod-1/config\n>    ls -a submod*\n>   )\n> \n> The end result is that `c` gets the `.gitmodules` path updates and new\n> gitlinked directory from the submodule move in `b` (using my\n> git-submodule-mv.sh posted earlier in this thread), but `submod-1` is\n> left lying around (because Git doesn't know that it can remove\n> submod-1/.git and submod-1/README).\n\nThat's just what current git does with removed submodules (but my\nrecursive submodule update series will handle that just fine).\n\n>  The Git directory for the\n> submodule stays in .git/modules/submod-1/ (good), but the worktree in\n> .git/modules/submod-1/config still points to ../../../submod-1 (bad).\n\nYou'll not only have to update the gitfile but also the core.worktree\nsetting in the repo. Sorry I missed that when you posted your script.\n\n> This means that submodule moves are possible, but anyone trying to\n> share them between several repositories (or trying to rebase across\n> the move within their own repository) is in for a world of suffering\n> ;).  I'm not sure how this should be addressed, but I didn't see\n> anything handling it in Jens' new series.\n\nIf you adjust core.worktree properly you'll just have the old\nsubmodule work tree lying around (just like you do after you rm'd\nit) and everything apart from that should just work.\n\nAs I mentioned that will be fixed by recursive submodule checkout.\nI'll see if I can polish my preliminary branch so that interested\npeople can play around with it if anyone is interested.\n"},{"id":"206311","messageId":"20130108174857.GF4662@odin.tremily.us","threadId":"32543","inReplyTo":"50EC536D.8050606@web.de","subject":"Re: Moving (renaming) submodules, recipe/script","fromName":"W. Trevor King","fromEmail":"wking@tremily.us","sentAt":"2013-01-08T17:48:57Z","receivedAt":"2013-01-08T17:48:57Z","isPatch":false,"sender":{"key":"wking@tremily.us","avatar":"https://avatars.githubusercontent.com/u/209920?v=4"},"body":"On Tue, Jan 08, 2013 at 06:12:13PM +0100, Jens Lehmann wrote:\n> Am 08.01.2013 15:32, schrieb W. Trevor King:\n> >  The Git directory for the\n> > submodule stays in .git/modules/submod-1/ (good), but the worktree in\n> > .git/modules/submod-1/config still points to ../../../submod-1 (bad).\n> \n> You'll not only have to update the gitfile but also the core.worktree\n> setting in the repo. Sorry I missed that when you posted your script.\n\nMy git-submodule-mv.sh script does update core.worktree.  The problem\nis that `git checkout`, `git merge`, etc. do not.\n\n> > This means that submodule moves are possible, but anyone trying to\n> > share them between several repositories (or trying to rebase across\n> > the move within their own repository) is in for a world of suffering\n> > ;).  I'm not sure how this should be addressed, but I didn't see\n> > anything handling it in Jens' new series.\n> \n> If you adjust core.worktree properly you'll just have the old\n> submodule work tree lying around (just like you do after you rm'd\n> it) and everything apart from that should just work.\n> \n> As I mentioned that will be fixed by recursive submodule checkout.\n> I'll see if I can polish my preliminary branch so that interested\n> people can play around with it if anyone is interested.\n\nSounds like a fix will be in here.  I'll definitely help put the\nbranch through its paces ;).\n\nTrevor\n\n-- \nThis email may be signed or encrypted with GnuPG (http://www.gnupg.org).\nFor more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy\n"}]}