{"thread":{"id":"33590","subject":"Git submodule repository locatio","startedAt":"2013-04-24T14:44:29Z","lastAt":"2013-04-24T15:11:19Z","messageCount":2,"participants":["Adam Stankiewicz","Fredrik Gustafsson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"215314","messageId":"5177EFCD.1020300@sher.pl","threadId":"33590","inReplyTo":null,"subject":"Git submodule repository locatio","fromName":"Adam Stankiewicz","fromEmail":"sheerun@sher.pl","sentAt":"2013-04-24T14:44:29Z","receivedAt":"2013-04-24T14:44:29Z","isPatch":false,"sender":{"key":"sheerun@sher.pl","avatar":"https://gravatar.com/avatar/b95a8e406cd367fcd73a857559d05f9ab1330f2fa1a5676cd54b009c7fc201b7?d=mp&s=160"},"body":"Currently each submodule contains single .git file (instead of directory)\nwith only link to project's base repository, for example \"gitdir:\n../../.git/modules/lib/neobundle.vim\".\n\nIn git base repository we find .git/modules directory that contains bare\nrepositories of all submodules, for example .git/modules/lib/neobundle.vim\ncontains bare repository of neobundle submodule.\n\nMy proposal is to move default bare repository location from .git/modules\nto .git directory inside submodule, like every normal git repo do.\n\nThese are my arguments:\n\n1. Why git submodule needs to know in which project it is embedded in? Or\neven that it's generally submodule? When cd to submodule, it behaves like\nnormal repository. Only repository needs to know about its submodules.\n2. You can't move submodule outside git repository and use it as normal git\nrepo. You have to copy bare repo from .git/modules dir.\n3. It's not enough to delete submodule from workingdir to \"refresh\" it\nlater. You have to go to .git/modules directory and delete appropriate\nfolder.\n\nWhat about performance on checkouts?\n\nIn systems supporting symlinks, the .git directory in submodule can be a\nsymlink to the .git/modules subdirectory. In systems that do not support\nthem, you can use mv-like command, that is very fast. Just move .git\ndirectory of submodule to .git/modules subdirectory, until you you need it\n(when you check out commit with \"Subproject commit 55d868e(...) object\").\n\nI propose introducing this change in next major version of git, as it can\nbreak some scripts that depend on git submodule repository location.\n\nPlease consider this \"feature request\" seriously, most people I know think\ngit submodules suck, and described issue is IMHO one of the reasons why.\n\nSincerely,\nAdam Stankiewicz (@sheerun)\n"},{"id":"215316","messageId":"20130424151119.GB25888@paksenarrion.iveqy.com","threadId":"33590","inReplyTo":"5177EFCD.1020300@sher.pl","subject":"Re: Git submodule repository locatio","fromName":"Fredrik Gustafsson","fromEmail":"iveqy@iveqy.com","sentAt":"2013-04-24T15:11:19Z","receivedAt":"2013-04-24T15:11:19Z","isPatch":false,"sender":{"key":"iveqy@iveqy.com","avatar":"https://avatars.githubusercontent.com/u/761743?v=4"},"body":"On Wed, Apr 24, 2013 at 04:44:29PM +0200, Adam Stankiewicz wrote:\n> My proposal is to move default bare repository location from .git/modules\n> to .git directory inside submodule, like every normal git repo do.\n\nThat's the way it was in old versions of git. The git-file approach was\nimplemented so git could deal with adding or removing submodules. For\nexample, if a submodule is not in version HEAD~ and you do a checkout\nHEAD~ your working dir should not contain the submodule. (Unfortunately\nwe are not there quite yet).\n\n> These are my arguments:\n> \n> 1. Why git submodule needs to know in which project it is embedded in? Or\n> even that it's generally submodule? When cd to submodule, it behaves like\n> normal repository. Only repository needs to know about its submodules.\n\nA git submodule doesn't know about it's superproject. All git repos can\nbe used with git-files. I wouldn't say that a .git-file makes a git repo\naware that it's a subproject (which doesn't even had to be true).\n\nThe superproject needs to work with the working-tree, having repo data\nin the worktree like svn and cvs is a bad thing. I really like having\nall meta data in the same spot.\n\nAnd there's the \"checkout old commit without submodule\" problem but\nof course, your \"mv-approach\" would solve this.\n\n> 2. You can't move submodule outside git repository and use it as normal git\n> repo. You have to copy bare repo from .git/modules dir.\n\nYou can, if you edit .git-file. However in either case your can't use\nyour superrepo in a sane way if you move out your submodule. So why\nwould you do that?\n\nIf you only need the submodule repo, just clone the submodule repo.\n\n> 3. It's not enough to delete submodule from workingdir to \"refresh\" it\n> later. You have to go to .git/modules directory and delete appropriate\n> folder.\n> \n> What about performance on checkouts?\n\nI think that performance penalty is too small to be cared about, if you\nlook at all the other file access stuff that git does every time.\n\n-- \nMed vänliga hälsningar\nFredrik Gustafsson\n\ntel: 0733-608274\ne-post: iveqy@iveqy.com\n"}]}