Closed
Description
I tried to use repo.submodule_update
on an freshly cloned repository that uses a relative url in the submodule. That fails with fatal: repository '../submodule-test-module' does not exist
.
It looks like some path handling is wrong, as a plain git submodule update --init --recursive
works fine.
repo = Repo.clone_from("https://github.com/david0/submodule-test-root.git", "repo")
repo.submodule_update(init=True, recursive=True)
Traceback (most recent call last):
File "/private/tmp/reproduce/venv/lib/python3.13/site-packages/git/objects/submodule/base.py", line 1417, in module
repo = git.Repo(module_checkout_abspath)
File "/private/tmp/reproduce/venv/lib/python3.13/site-packages/git/repo/base.py", line 289, in __init__
raise InvalidGitRepositoryError(epath)
git.exc.InvalidGitRepositoryError: /private/tmp/reproduce/repo/submodule-test-module
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/private/tmp/reproduce/venv/lib/python3.13/site-packages/git/objects/submodule/base.py", line 739, in update
mrepo = self.module()
File "/private/tmp/reproduce/venv/lib/python3.13/site-packages/git/util.py", line 176, in wrapper
return func(self, *args, **kwargs)
File "/private/tmp/reproduce/venv/lib/python3.13/site-packages/git/objects/submodule/base.py", line 1422, in module
raise InvalidGitRepositoryError("No valid repository at %s" % module_checkout_abspath) from e
git.exc.InvalidGitRepositoryError: No valid repository at /private/tmp/reproduce/repo/submodule-test-module
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/private/tmp/reproduce/main.py", line 8, in <module>
repo.submodule_update(init=True, recursive=True)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/tmp/reproduce/venv/lib/python3.13/site-packages/git/repo/base.py", line 533, in submodule_update
return RootModule(self).update(*args, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/private/tmp/reproduce/venv/lib/python3.13/site-packages/git/objects/submodule/root.py", line 427, in update
sm.update(
~~~~~~~~~^
recursive=False,
^^^^^^^^^^^^^^^^
...<5 lines>...
keep_going=keep_going,
^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/private/tmp/reproduce/venv/lib/python3.13/site-packages/git/objects/submodule/base.py", line 797, in update
mrepo = self._clone_repo(
self.repo,
...<7 lines>...
allow_unsafe_protocols=allow_unsafe_protocols,
)
File "/private/tmp/reproduce/venv/lib/python3.13/site-packages/git/objects/submodule/base.py", line 356, in _clone_repo
clone = git.Repo.clone_from(
url,
...<3 lines>...
**kwargs,
)
File "/private/tmp/reproduce/venv/lib/python3.13/site-packages/git/repo/base.py", line 1541, in clone_from
return cls._clone(
~~~~~~~~~~^
git,
^^^^
...<7 lines>...
**kwargs,
^^^^^^^^^
)
^
File "/private/tmp/reproduce/venv/lib/python3.13/site-packages/git/repo/base.py", line 1412, in _clone
finalize_process(proc, stderr=stderr)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/private/tmp/reproduce/venv/lib/python3.13/site-packages/git/util.py", line 504, in finalize_process
proc.wait(**kwargs)
~~~~~~~~~^^^^^^^^^^
File "/private/tmp/reproduce/venv/lib/python3.13/site-packages/git/cmd.py", line 834, in wait
raise GitCommandError(remove_password_if_present(self.args), status, errstr)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
cmdline: git clone -v -n --separate-git-dir=/private/tmp/reproduce/repo/.git/modules/submodule-test-module -- ../submodule-test-module /private/tmp/reproduce/repo/submodule-test-module
stderr: 'fatal: repository '../submodule-test-module' does not exist
'
Metadata
Metadata
Assignees
Labels
No labels