author | Jens Lehmann <Jens.Lehmann@web.de> | |
Tue, 24 Jan 2012 21:49:56 +0000 (22:49 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 24 Jan 2012 22:18:18 +0000 (14:18 -0800) | ||
commit | 1017c1abcb6d733e1de83eb5a1cf7e1bf4ad6aca | |
tree | b73600700d9bbe43f66b40cb6056aba055f3be8f | tree | snapshot |
parent | 0b26d1e8b29a4248d56078318fec6906e3007742 | commit | diff |
submodule add: fix breakage when re-adding a deep submodule
Since recently a submodule with name <name> has its git directory in the
.git/modules/<name> directory of the superproject while the work tree
contains a gitfile pointing there.
When the same submodule is added on a branch where it wasn't present so
far (it is not found in the .gitmodules file), the name is not initialized
from the path as it should. This leads to a wrong path entered in the
gitfile when the .git/modules/<name> directory is found, as this happily
uses the - now empty - name. It then always points only a single directory
up, even if we have a path deeper in the directory hierarchy.
Fix that by initializing the name of the submodule early in module_clone()
if module_name() returned an empty name and add a test to catch that bug.
Reported-by: Jehan Bing <jehan@orb.com>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Since recently a submodule with name <name> has its git directory in the
.git/modules/<name> directory of the superproject while the work tree
contains a gitfile pointing there.
When the same submodule is added on a branch where it wasn't present so
far (it is not found in the .gitmodules file), the name is not initialized
from the path as it should. This leads to a wrong path entered in the
gitfile when the .git/modules/<name> directory is found, as this happily
uses the - now empty - name. It then always points only a single directory
up, even if we have a path deeper in the directory hierarchy.
Fix that by initializing the name of the submodule early in module_clone()
if module_name() returned an empty name and add a test to catch that bug.
Reported-by: Jehan Bing <jehan@orb.com>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-submodule.sh | diff | blob | history | |
t/t7406-submodule-update.sh | diff | blob | history |