summaryrefslogtreecommitdiff
path: root/git/test/test_submodule.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2015-01-17 17:19:06 +0100
committerSebastian Thiel <byronimo@gmail.com>2015-01-17 17:19:06 +0100
commitc15a6e1923a14bc760851913858a3942a4193cdb (patch)
treed8dc5acd1ab2502a63b91b34372b4f9cd83d78bc /git/test/test_submodule.py
parentae2b59625e9bde14b1d2d476e678326886ab1552 (diff)
downloadgitpython-c15a6e1923a14bc760851913858a3942a4193cdb.tar.gz
Submodule.remove() now seems to work properly, nearly all tests are back.
This also means that now we seem to be able to properly handle .git files in submodules Related to #233
Diffstat (limited to 'git/test/test_submodule.py')
-rw-r--r--git/test/test_submodule.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py
index ace7ab07..dc6c8a1a 100644
--- a/git/test/test_submodule.py
+++ b/git/test/test_submodule.py
@@ -508,7 +508,11 @@ class TestSubmodule(TestBase):
rm.update(recursive=False, dry_run=True)
assert os.path.isdir(smp)
- rm.update(recursive=False)
+ # when removing submodules, we may get new commits as nested submodules are auto-committing changes
+ # to allow deletions without force, as the index would be dirty otherwise.
+ # QUESTION: Why does this seem to work in test_git_submodule_compatibility() ?
+ self.failUnlessRaises(InvalidGitRepositoryError, rm.update, recursive=False, force_remove=False)
+ rm.update(recursive=False, force_remove=True)
assert not os.path.isdir(smp)
# change url
@@ -664,14 +668,19 @@ class TestSubmodule(TestBase):
assert sm.exists()
assert sm.module_exists()
+ # Add additional submodule level
+ sm.module().create_submodule('nested-submodule', 'nested-submodule/working-tree',
+ url=self._submodule_url())
+ sm.module().index.commit("added nested submodule")
+ # Fails because there are new commits, compared to the remote we cloned from
+ self.failUnlessRaises(InvalidGitRepositoryError, sm.remove, dry_run=True)
+
# remove
sm_module_path = sm.module().git_dir
for dry_run in (True, False):
- sm.remove(dry_run=dry_run)
+ sm.remove(dry_run=dry_run, force=True)
assert sm.exists() == dry_run
assert sm.module_exists() == dry_run
assert os.path.isdir(sm_module_path) == dry_run
# end for each dry-run mode
-
-