summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaroslav Halchenko <debian@onerussian.com>2016-10-02 10:13:22 -0400
committerKostis Anagnostopoulos <ankostis@gmail.com>2016-10-03 00:54:25 +0200
commit361854d1782b8f59dc02aa37cfe285df66048ce6 (patch)
treed29860da48dde5175f3a5b7048a326f09cd40e8c
parent6497d1e843cbaec2b86cd5a284bd95c693e55cc0 (diff)
downloadgitpython-361854d1782b8f59dc02aa37cfe285df66048ce6.tar.gz
TST: Add test for removing submodule with remotes without refs
-rw-r--r--git/test/test_submodule.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py
index bfa0379d..6dcf1831 100644
--- a/git/test/test_submodule.py
+++ b/git/test/test_submodule.py
@@ -317,8 +317,8 @@ class TestSubmodule(TestBase):
# forcibly delete the child repository
prev_count = len(sm.children())
self.failUnlessRaises(ValueError, csm.remove, force=True)
- # We removed sm, which removed all submodules. Howver, the instance we have
- # still points to the commit prior to that, where it still existed
+ # We removed sm, which removed all submodules. However, the instance we
+ # have still points to the commit prior to that, where it still existed
csm.set_parent_commit(csm.repo.commit(), check=False)
assert not csm.exists()
assert not csm.module_exists()
@@ -802,6 +802,24 @@ class TestSubmodule(TestBase):
# end for each dry-run mode
@with_rw_directory
+ def test_remove_norefs(self, rwdir):
+ 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
+ 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):
parent = git.Repo.init(os.path.join(rwdir, 'parent'))
sm_name = 'mymodules/myname'