From f284a4e7c8861381b0139b76af4d5f970edb7400 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Sun, 2 Oct 2016 10:27:53 -0400 Subject: TST: finishing test for removing submodule with remotes without refs originally draft committed by mistake in 31fd955dfcc8176fd65f92fa859374387d3e0095 sorry --- git/test/test_submodule.py | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'git/test/test_submodule.py') diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py index eae6ab9f..6dcf1831 100644 --- a/git/test/test_submodule.py +++ b/git/test/test_submodule.py @@ -806,25 +806,18 @@ class TestSubmodule(TestBase): parent = git.Repo.init(os.path.join(rwdir, 'parent')) sm_name = 'mymodules/myname' sm = parent.create_submodule(sm_name, sm_name, url=self._small_repo_url()) + assert sm.exists() + parent.index.commit("Added submodule") + assert sm.repo is parent # yoh was surprised since expected sm repo!! + # so created a new instance for submodule + smrepo = git.Repo(os.path.join(rwdir, 'parent', sm.path)) # Adding a remote without fetching so would have no references - sm.repo.create_remote('special', 'git@server-shouldnotmatter:repo.git') - assert sm.rename(sm_name) is sm and sm.name == sm_name - assert not sm.repo.is_dirty(index=True, working_tree=False, untracked_files=False) - - new_path = 'renamed/myname' - assert sm.move(new_path).name == new_path - - new_sm_name = "shortname" - assert sm.rename(new_sm_name) is sm - assert sm.repo.is_dirty(index=True, working_tree=False, untracked_files=False) - assert sm.exists() - - sm_mod = sm.module() - if os.path.isfile(os.path.join(sm_mod.working_tree_dir, '.git')) == sm._need_gitfile_submodules(parent.git): - assert sm_mod.git_dir.endswith(join_path_native('.git', 'modules', new_sm_name)) - # end + smrepo.create_remote('special', 'git@server-shouldnotmatter:repo.git') + # And we should be able to remove it just fine + sm.remove() + assert not sm.exists() @with_rw_directory def test_rename(self, rwdir): -- cgit v1.2.1