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

Allow relative path url in submodules for submodule_update#2062

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
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
7 changes: 6 additions & 1 deletiongit/objects/submodule/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,7 @@
import stat
import sys
import uuid
import urllib

import git
from git.cmd import Git
Expand DownExpand Up@@ -799,9 +800,13 @@ def update(
+ "Cloning url '%s' to '%s' in submodule %r" % (self.url, checkout_module_abspath, self.name),
)
if not dry_run:
if self.url.startswith("."):
url = urllib.parse.urljoin(self.repo.remotes.origin.url + "/", self.url)
else:
url = self.url
mrepo = self._clone_repo(
self.repo,
self.url,
url,
self.path,
self.name,
n=True,
Expand Down
20 changes: 20 additions & 0 deletionstest/test_submodule.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1350,3 +1350,23 @@ def test_submodule_update_unsafe_options_allowed(self, rw_repo):
for unsafe_option in unsafe_options:
with self.assertRaises(GitCommandError):
submodule.update(clone_multi_options=[unsafe_option], allow_unsafe_options=True)

@with_rw_directory
@_patch_git_config("protocol.file.allow", "always")
def test_submodule_update_relative_url(self, rwdir):
parent_path = osp.join(rwdir, "parent")
parent_repo = git.Repo.init(parent_path)
submodule_path = osp.join(rwdir, "module")
submodule_repo = git.Repo.init(submodule_path)
submodule_repo.git.commit(m="initial commit", allow_empty=True)

parent_repo.git.submodule("add", "../module", "module")
parent_repo.index.commit("add submodule with relative URL")

cloned_path = osp.join(rwdir, "cloned_repo")
cloned_repo = git.Repo.clone_from(parent_path, cloned_path)

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

has_module = any(sm.name == "module" for sm in cloned_repo.submodules)
assert has_module, "Relative submodule was not updated properly"
Loading

[8]ページ先頭

©2009-2025 Movatter.jp