def test_rename(self, rwdir):
parent = git.Repo.init(osp.join(rwdir, 'parent'))
sm_name = 'mymodules/myname'
sm = parent.create_submodule(sm_name, sm_name, url=self._small_repo_url())
parent.index.commit("Added submodule")
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 osp.isfile(osp.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
评论列表
文章目录