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

git.Repo.submodule_update check for remote branch even though "to_latest_revision=False" #545

Closed
Assignees
Byron
@ghost

Description

As I understand the doc, "to_latest_revision" should work similar to --remote as in "git submodule update --remote". However, GitPython still check remote branches even though "to_latest_revision" is set to False.

Basically I want to do this:
$ git submodule update --init --recursive

But since I have a branch in my .gitmodules file that doesn't exist remote then I get the following error:

File "C:/Users/myuser/fetch_submodules.py", line 84, in setup_repo
repo.submodule_update(recursive=True, force_reset=True, force_remove=True)
File "C:\Python27\lib\site-packages\git\repo\base.py", line 305, in submodule_update
return RootModule(self).update(_args, *_kwargs)
File "C:\Python27\lib\site-packages\git\objects\submodule\root.py", line 327, in update
progress=progress, dry_run=dry_run, force=force_reset, keep_going=keep_going)
File "C:\Python27\lib\site-packages\git\objects\submodule\base.py", line 529, in update
remote_branch = find_first_remote_branch(mrepo.remotes, self.branch_name)
File "C:\Python27\lib\site-packages\git\objects\submodule\util.py", line 38, in find_first_remote_branch
raise InvalidGitRepositoryError("Didn't find remote branch '%r' in any of the given remotes" % branch_name)
git.exc.InvalidGitRepositoryError: Didn't find remote branch ''.'' in any of the given remotes

Should GitPython care about my .gitmodules branch when I don't specify "to_latest_revision=True"?

Why I need to have a branch in .gitmodules that doesn't exist remote maybe doesn't make much sense but it has to do with Gerrit Code-Review submodule subscription that automatically updates the super repo for each submodule commit. Seehttps://gerrit-documentation.storage.googleapis.com/Documentation/2.13.2/user-submodules.html#_defining_the_submodule_branch for further details.

.gitmodules
[submodule "common"]
path = common
url = ssh://gitrepourl/repo
branch = .

I hope i don't misunderstand "to_latest_revision".

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp