|
2 | 2 | # This module is part of GitPython and is released under
|
3 | 3 | # the BSD License: http://www.opensource.org/licenses/bsd-license.php
|
4 | 4 | importos
|
| 5 | +importshutil |
5 | 6 | importsys
|
6 | 7 | fromunittestimportskipIf
|
7 | 8 |
|
@@ -660,6 +661,24 @@ def test_add_empty_repo(self, rwdir):
|
660 | 661 | url=empty_repo_dir,no_checkout=checkout_modeandTrueorFalse)
|
661 | 662 | # end for each checkout mode
|
662 | 663 |
|
| 664 | +@with_rw_directory |
| 665 | +deftest_list_only_valid_submodules(self,rwdir): |
| 666 | +repo_path=osp.join(rwdir,'parent') |
| 667 | +repo=git.Repo.init(repo_path) |
| 668 | +repo.git.submodule('add',self._small_repo_url(),'module') |
| 669 | +repo.index.commit("add submodule") |
| 670 | + |
| 671 | +assertlen(repo.submodules)==1 |
| 672 | + |
| 673 | +# Delete the directory from submodule |
| 674 | +submodule_path=osp.join(repo_path,'module') |
| 675 | +shutil.rmtree(submodule_path) |
| 676 | +repo.git.add([submodule_path]) |
| 677 | +repo.index.commit("remove submodule") |
| 678 | + |
| 679 | +repo=git.Repo(repo_path) |
| 680 | +assertlen(repo.submodules)==0 |
| 681 | + |
663 | 682 | @skipIf(HIDE_WINDOWS_KNOWN_ERRORS,
|
664 | 683 | """FIXME on cygwin: File "C:\\projects\\gitpython\\git\\cmd.py", line 671, in execute
|
665 | 684 | raise GitCommandError(command, status, stderr_value, stdout_value)
|
|