diff options
author | Jens Lehmann <Jens.Lehmann@web.de> | 2012-09-30 01:05:58 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-09-29 21:49:11 -0700 |
commit | 73b0898d0d04d432525f9d56e29bf70fc7bf6ea9 (patch) | |
tree | 29633187baa2b1a42edf17639017440fcae391f4 /Documentation/gitmodules.txt | |
parent | 652398a88e7c3d18b6820a2ae369b05d26dc757f (diff) | |
download | git-73b0898d0d04d432525f9d56e29bf70fc7bf6ea9.tar.gz git-73b0898d0d04d432525f9d56e29bf70fc7bf6ea9.tar.xz |
Teach "git submodule add" the --name option
"git submodule add" initializes the name of a submodule to its path. This
was ok as long as the .git directory lived inside the submodule's work
tree, but since 1.7.8 it is stored in the .git/modules/<name> directory of
the superproject, making the submodule name survive the removal of the
submodule's work tree. This leads to problems when the user tries to add a
different submodule at the same path - and thus the same name - later, as
that will happily try to restore the submodule from the old repository
instead of the one the user specified and will lead to a checkout of the
wrong repository.
Add the new "--name" option to let the user provide a name for the
submodule. This enables the user to solve this conflict without having to
remove .git/modules/<name> by hand (which is no viable solution as it
makes it impossible to checkout a commit that records the old submodule
and populate it, as that will still check out the new submodule for the
same reason).
To achieve that the submodule's name is added to the parameter list of
the module_clone() helper function. This makes it possible to remove the
call of module_name() there because both callers of module_clone() already
know the name and can provide it as argument number two.
Reported-by: Jonathan Johnson <me@jondavidjohn.com>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/gitmodules.txt')
-rw-r--r-- | Documentation/gitmodules.txt | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Documentation/gitmodules.txt b/Documentation/gitmodules.txt index 4effd7890..ab3e91c05 100644 --- a/Documentation/gitmodules.txt +++ b/Documentation/gitmodules.txt @@ -18,7 +18,9 @@ working tree, is a text file with a syntax matching the requirements of linkgit:git-config[1]. The file contains one subsection per submodule, and the subsection value -is the name of the submodule. Each submodule section also contains the +is the name of the submodule. The name is set to the path where the +submodule has been added unless it was customized with the '--name' +option of 'git submodule add'. Each submodule section also contains the following required keys: submodule.<name>.path:: |