Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit21b1767

Browse files
stsewdByron
authored andcommitted
Add test
1 parenta02facd commit21b1767

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
importos
5+
importshutil
56
importsys
67
fromunittestimportskipIf
78

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

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+
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)

[8]ページ先頭

©2009-2025 Movatter.jp