Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9965963

Browse files
authored
Towards handling of relative submodule paths
Towards gitpython-developers#730
1 parent 11fd713 commit 9965963

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

git/objects/submodule/root.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
)
88
from git.exc import InvalidGitRepositoryError
99
import git
10+
import os
1011

1112
import logging
1213

@@ -178,6 +179,14 @@ def update(self, previous_commit=None, recursive=True, force_remove=False, init=
178179
progress.update(
179180
END | PATHCHANGE, i, len_csms, prefix + "Done moving repository of submodule %r" % sm.name)
180181
# END handle path changes
182+
183+
# HANDLE RELATIVE URL
184+
###################
185+
if sm.url.startswith('..'):
186+
actual_url = os.path.join(repo.remotes.origin.url, sm.url)
187+
with sm.config_writer() as writer:
188+
writer.set('url', actual_url)
189+
###################
181190

182191
if sm.module_exists():
183192
# HANDLE URL CHANGE

0 commit comments

Comments
 (0)