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

Commit361854d

Browse files
yarikopticankostis
authored andcommitted
TST: Add test for removing submodule with remotes without refs
1 parent6497d1e commit361854d

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

‎git/test/test_submodule.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ def _do_base_tests(self, rwrepo):
317317
# forcibly delete the child repository
318318
prev_count=len(sm.children())
319319
self.failUnlessRaises(ValueError,csm.remove,force=True)
320-
# We removed sm, which removed all submodules.Howver, the instance we have
321-
# still points to the commit prior to that, where it still existed
320+
# We removed sm, which removed all submodules.However, the instance we
321+
#havestill points to the commit prior to that, where it still existed
322322
csm.set_parent_commit(csm.repo.commit(),check=False)
323323
assertnotcsm.exists()
324324
assertnotcsm.module_exists()
@@ -801,6 +801,24 @@ def assert_exists(sm, value=True):
801801
assertos.path.isdir(sm_module_path)==dry_run
802802
# end for each dry-run mode
803803

804+
@with_rw_directory
805+
deftest_remove_norefs(self,rwdir):
806+
parent=git.Repo.init(os.path.join(rwdir,'parent'))
807+
sm_name='mymodules/myname'
808+
sm=parent.create_submodule(sm_name,sm_name,url=self._small_repo_url())
809+
assertsm.exists()
810+
811+
parent.index.commit("Added submodule")
812+
813+
assertsm.repoisparent# yoh was surprised since expected sm repo!!
814+
# so created a new instance for submodule
815+
smrepo=git.Repo(os.path.join(rwdir,'parent',sm.path))
816+
# Adding a remote without fetching so would have no references
817+
smrepo.create_remote('special','git@server-shouldnotmatter:repo.git')
818+
# And we should be able to remove it just fine
819+
sm.remove()
820+
assertnotsm.exists()
821+
804822
@with_rw_directory
805823
deftest_rename(self,rwdir):
806824
parent=git.Repo.init(os.path.join(rwdir,'parent'))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp