Subject: Git submodule repository locatio

From: Adam Stankiewicz <[email-masked]>
Date: Wed, 24 Apr 2013 16:44:29 +0200

Currently each submodule contains single .git file (instead of directory)
with only link to project's base repository, for example "gitdir:
../../.git/modules/lib/neobundle.vim".

In git base repository we find .git/modules directory that contains bare
repositories of all submodules, for example .git/modules/lib/neobundle.vim
contains bare repository of neobundle submodule.

My proposal is to move default bare repository location from .git/modules
to .git directory inside submodule, like every normal git repo do.

These are my arguments:

1. Why git submodule needs to know in which project it is embedded in? Or
even that it's generally submodule? When cd to submodule, it behaves like
normal repository. Only repository needs to know about its submodules.
2. You can't move submodule outside git repository and use it as normal git
repo. You have to copy bare repo from .git/modules dir.
3. It's not enough to delete submodule from workingdir to "refresh" it
later. You have to go to .git/modules directory and delete appropriate
folder.

What about performance on checkouts?

In systems supporting symlinks, the .git directory in submodule can be a
symlink to the .git/modules subdirectory. In systems that do not support
them, you can use mv-like command, that is very fast. Just move .git
directory of submodule to .git/modules subdirectory, until you you need it
(when you check out commit with "Subproject commit 55d868e(...) object").

I propose introducing this change in next major version of git, as it can
break some scripts that depend on git submodule repository location.

Please consider this "feature request" seriously, most people I know think
git submodules suck, and described issue is IMHO one of the reasons why.

Sincerely,
Adam Stankiewicz (@sheerun)