Skip to content

Commit 21b1767

Browse files
stsewdByron
authored andcommitted
Add test
1 parent a02facd commit 21b1767

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

git/test/test_submodule.py

Lines 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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy