Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 21b1767

Browse filesBrowse files
stsewdByron
authored andcommitted
Add test
1 parent a02facd commit 21b1767
Copy full SHA for 21b1767

File tree

1 file changed

+19
-0
lines changed
Filter options

1 file changed

+19
-0
lines changed

‎git/test/test_submodule.py

Copy file name to clipboardExpand all lines: git/test/test_submodule.py
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# This module is part of GitPython and is released under
33
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
44
import os
5+
import shutil
56
import sys
67
from unittest import skipIf
78

@@ -660,6 +661,24 @@ def test_add_empty_repo(self, rwdir):
660661
url=empty_repo_dir, no_checkout=checkout_mode and True or False)
661662
# end for each checkout mode
662663

664+
@with_rw_directory
665+
def test_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+
assert len(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+
assert len(repo.submodules) == 0
681+
663682
@skipIf(HIDE_WINDOWS_KNOWN_ERRORS,
664683
"""FIXME on cygwin: File "C:\\projects\\gitpython\\git\\cmd.py", line 671, in execute
665684
raise GitCommandError(command, status, stderr_value, stdout_value)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.