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

Commita223c7b

Browse files
committed
Submodule.move() fixed to deal with 'non-gitfile' clones appropriately.
Improved a test to assure multiple update(init=False|True) calls don'tthrow.Fixesgitpython-developers#93
1 parentd4ce247 commita223c7b

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

‎git/objects/submodule/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ def move(self, module_path, configuration=True, module=True):
636636
os.renames(cur_path,module_checkout_abspath)
637637
renamed_module=True
638638

639-
ifself._need_gitfile_submodules(self.repo.git):
639+
ifos.path.isfile(os.path.join(module_checkout_abspath,'.git')):
640640
module_abspath=self._module_abspath(self.repo,self.path,self.name)
641641
self._write_git_file_and_module_config(module_checkout_abspath,module_abspath)
642642
# end handle git file rewrite

‎git/test/test_submodule.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,6 @@ def _do_base_tests(self, rwrepo):
377377
assertnsm.path==pmp
378378
assertrwrepo.submodules[0].path==pmp
379379

380-
# TODO lowprio: test remaining exceptions ... for now its okay, the code looks right
381-
382380
# REMOVE 'EM ALL
383381
################
384382
# if a submodule's repo has no remotes, it can't be added without an explicit url
@@ -636,8 +634,20 @@ def test_git_submodules(self, rwdir):
636634

637635
assertsm.exists()andsm.module_exists()
638636

639-
# test move and rename
640-
# TODO
637+
clone=git.Repo.clone_from(self._submodule_url(),
638+
os.path.join(parent.working_tree_dir,'existing-subrepository'))
639+
sm2=parent.create_submodule('nongit-file-submodule',clone.working_tree_dir)
640+
assertlen(parent.submodules)==2
641+
642+
for_inrange(2):
643+
forinitin (False,True):
644+
sm.update(init=init)
645+
sm2.update(init=init)
646+
# end for each init state
647+
# end for each iteration
648+
649+
sm.move(sm.path+'_moved')
650+
sm2.move(sm2.path+'_moved')
641651

642652
@with_rw_directory
643653
deftest_git_submodule_compatibility(self,rwdir):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp