diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2015-01-20 21:35:28 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2015-01-20 21:35:28 +0100 |
commit | 80701fc6f4bf74d3c6176d76563894ff0f3b32bb (patch) | |
tree | 4627cdeb4d53f85e9ad877fba7eb1b01de5281d1 /git/test/test_submodule.py | |
parent | 9fbae711b76a4f2fa9345f43da6d2cdedd75d6c3 (diff) | |
download | gitpython-80701fc6f4bf74d3c6176d76563894ff0f3b32bb.tar.gz |
Submodule.parent_commit() now automatically points to repo.head unless it was set before.
That way, you don't always have to keep the parent commit uptodate when changing the
repo, which can lead to errors which are hard to debug and make no sense to the user,
who previously never set parent_commit (yet it matters thanks to the cache).
Diffstat (limited to 'git/test/test_submodule.py')
-rw-r--r-- | git/test/test_submodule.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py index 06036f53..047e0049 100644 --- a/git/test/test_submodule.py +++ b/git/test/test_submodule.py @@ -320,9 +320,11 @@ class TestSubmodule(TestBase): assert sm.config_reader().get_value('url') # delete the rest + sm_path = sm.path sm.remove() assert not sm.exists() assert not sm.module_exists() + self.failUnlessRaises(ValueError, getattr, sm, 'path') assert len(rwrepo.submodules) == 0 @@ -359,11 +361,11 @@ class TestSubmodule(TestBase): # MOVE MODULE ############# - # invalid inptu + # invalid input self.failUnlessRaises(ValueError, nsm.move, 'doesntmatter', module=False, configuration=False) # renaming to the same path does nothing - assert nsm.move(sm.path) is nsm + assert nsm.move(sm_path) is nsm # rename a module nmp = join_path_native("new", "module", "dir") + "/" # new module path @@ -708,7 +710,6 @@ class TestSubmodule(TestBase): # test move new_sm_path = 'submodules/one' - sm.set_parent_commit(parent.commit()) sm.move(new_sm_path) assert_exists(sm) @@ -717,7 +718,6 @@ class TestSubmodule(TestBase): url=self._submodule_url()) sm.module().index.commit("added nested submodule") sm_head_commit = sm.module().commit() - csm.set_parent_commit(sm_head_commit) assert_exists(csm) # Fails because there are new commits, compared to the remote we cloned from @@ -739,7 +739,6 @@ class TestSubmodule(TestBase): csm_writer = csm.config_writer().set_value('url', 'foo') csm_writer.release() csm.repo.index.commit("Have to commit submodule change for algorithm to pick it up") - csm.set_parent_commit(csm.repo.commit()) assert csm.url == 'foo' self.failUnlessRaises(Exception, rsm.update, recursive=True, to_latest_revision=True, progress=prog) @@ -760,7 +759,6 @@ class TestSubmodule(TestBase): sm_name = 'mymodules/myname' sm = parent.create_submodule(sm_name, sm_name, url=self._submodule_url()) parent.index.commit("Added submodule") - assert sm._parent_commit is not None 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) |