diff options
-rw-r--r-- | git/objects/submodule/base.py | 2 | ||||
-rw-r--r-- | git/test/test_submodule.py | 18 |
2 files changed, 15 insertions, 5 deletions
diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py index 3e3eed78..1d05609d 100644 --- a/git/objects/submodule/base.py +++ b/git/objects/submodule/base.py @@ -636,7 +636,7 @@ class Submodule(util.IndexObject, Iterable, Traversable): os.renames(cur_path, module_checkout_abspath) renamed_module = True - if self._need_gitfile_submodules(self.repo.git): + if os.path.isfile(os.path.join(module_checkout_abspath, '.git')): module_abspath = self._module_abspath(self.repo, self.path, self.name) self._write_git_file_and_module_config(module_checkout_abspath, module_abspath) # end handle git file rewrite diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py index 7fe882e1..7cd86bd9 100644 --- a/git/test/test_submodule.py +++ b/git/test/test_submodule.py @@ -377,8 +377,6 @@ class TestSubmodule(TestBase): assert nsm.path == pmp assert rwrepo.submodules[0].path == pmp - # TODO lowprio: test remaining exceptions ... for now its okay, the code looks right - # REMOVE 'EM ALL ################ # if a submodule's repo has no remotes, it can't be added without an explicit url @@ -636,8 +634,20 @@ class TestSubmodule(TestBase): assert sm.exists() and sm.module_exists() - # test move and rename - # TODO + clone = git.Repo.clone_from(self._submodule_url(), + os.path.join(parent.working_tree_dir, 'existing-subrepository')) + sm2 = parent.create_submodule('nongit-file-submodule', clone.working_tree_dir) + assert len(parent.submodules) == 2 + + for _ in range(2): + for init in (False, True): + sm.update(init=init) + sm2.update(init=init) + # end for each init state + # end for each iteration + + sm.move(sm.path + '_moved') + sm2.move(sm2.path + '_moved') @with_rw_directory def test_git_submodule_compatibility(self, rwdir): |