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

fix updating submodules with relative urls#2051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletionsgit/objects/submodule/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -353,6 +353,11 @@ def _clone_repo(
os.makedirs(module_abspath_dir)
module_checkout_path = osp.join(str(repo.working_tree_dir), path)

if url.startswith("../"):
remote_name = repo.active_branch.tracking_branch().remote_name
repo_remote_url = repo.remote(remote_name).url
url = os.path.join(repo_remote_url, url)

clone = git.Repo.clone_from(
url,
module_checkout_path,
Expand Down
16 changes: 16 additions & 0 deletionstest/test_submodule.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -753,6 +753,22 @@ def test_add_empty_repo(self, rwdir):
)
# END for each checkout mode

@with_rw_directory
@_patch_git_config("protocol.file.allow", "always")
def test_update_submodule_with_relative_path(self, rwdir):
repo_path = osp.join(rwdir, "parent")
repo = git.Repo.init(repo_path)
module_repo_path = osp.join(rwdir, "module")
module_repo = git.Repo.init(module_repo_path)
module_repo.git.commit(m="test", allow_empty=True)
repo.git.submodule("add", "../module", "module")
repo.index.commit("add submodule")

cloned_repo_path = osp.join(rwdir, "cloned_repo")
cloned_repo = git.Repo.clone_from(repo_path, cloned_repo_path)

cloned_repo.submodule_update(init=True, recursive=True)

@with_rw_directory
@_patch_git_config("protocol.file.allow", "always")
def test_list_only_valid_submodules(self, rwdir):
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp