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

Commit7677c05

Browse files
authored
Merge pull request#2051 from david0/fix-issue-730-relative-submodule
fix updating submodules with relative urls
2 parents85c8155 +1d80891 commit7677c05

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

‎git/objects/submodule/base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,11 @@ def _clone_repo(
353353
os.makedirs(module_abspath_dir)
354354
module_checkout_path=osp.join(str(repo.working_tree_dir),path)
355355

356+
ifurl.startswith("../"):
357+
remote_name=repo.active_branch.tracking_branch().remote_name
358+
repo_remote_url=repo.remote(remote_name).url
359+
url=os.path.join(repo_remote_url,url)
360+
356361
clone=git.Repo.clone_from(
357362
url,
358363
module_checkout_path,

‎test/test_submodule.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,22 @@ def test_add_empty_repo(self, rwdir):
753753
)
754754
# END for each checkout mode
755755

756+
@with_rw_directory
757+
@_patch_git_config("protocol.file.allow","always")
758+
deftest_update_submodule_with_relative_path(self,rwdir):
759+
repo_path=osp.join(rwdir,"parent")
760+
repo=git.Repo.init(repo_path)
761+
module_repo_path=osp.join(rwdir,"module")
762+
module_repo=git.Repo.init(module_repo_path)
763+
module_repo.git.commit(m="test",allow_empty=True)
764+
repo.git.submodule("add","../module","module")
765+
repo.index.commit("add submodule")
766+
767+
cloned_repo_path=osp.join(rwdir,"cloned_repo")
768+
cloned_repo=git.Repo.clone_from(repo_path,cloned_repo_path)
769+
770+
cloned_repo.submodule_update(init=True,recursive=True)
771+
756772
@with_rw_directory
757773
@_patch_git_config("protocol.file.allow","always")
758774
deftest_list_only_valid_submodules(self,rwdir):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp