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 submodules listing error#818

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
5 changes: 3 additions & 2 deletionsgit/objects/submodule/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1184,8 +1184,9 @@ def iter_items(cls, repo, parent_commit='HEAD'):
entry = index.entries[index.entry_key(p, 0)]
sm = Submodule(repo, entry.binsha, entry.mode, entry.path)
except KeyError:
raise InvalidGitRepositoryError(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Is there a way for this Exception to stay, just as there is a test that expects this behaviour (see the test-failure on travis).

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

If we do that, we wouldn't be able to keep listing the submodules here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@stsewd I think all that's left before the merge is to fix the now failing test. It could be changed to now expect to no failure and to see a listing of the existing submodules - if you think there is not too much overlap with the test you added.

stsewd reacted with thumbs up emoji
"Gitmodule path %r did not exist in revision of parent commit %s" % (p, parent_commit))
# The submodule doesn't exist, probably it wasn't
# removed from the .gitmodules file.
continue
# END handle keyerror
# END handle critical error

Expand Down
24 changes: 21 additions & 3 deletionsgit/test/test_submodule.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import os
import shutil
import sys
from unittest import skipIf

Expand DownExpand Up@@ -479,9 +480,8 @@ def test_root_module(self, rwrepo):
with sm.config_writer() as writer:
writer.set_value('path', fp) # change path to something with prefix AFTER url change

# update fails as list_items in such a situations cannot work, as it cannot
# find the entry at the changed path
self.failUnlessRaises(InvalidGitRepositoryError, rm.update, recursive=False)
# update doesn't fail, because list_items ignores the wrong path in such situations.
rm.update(recursive=False)

# move it properly - doesn't work as it its path currently points to an indexentry
# which doesn't exist ( move it to some path, it doesn't matter here )
Expand DownExpand Up@@ -660,6 +660,24 @@ def test_add_empty_repo(self, rwdir):
url=empty_repo_dir, no_checkout=checkout_mode and True or False)
# end for each checkout mode

@with_rw_directory
def test_list_only_valid_submodules(self, rwdir):
repo_path = osp.join(rwdir, 'parent')
repo = git.Repo.init(repo_path)
repo.git.submodule('add', self._small_repo_url(), 'module')
repo.index.commit("add submodule")

assert len(repo.submodules) == 1

# Delete the directory from submodule
submodule_path = osp.join(repo_path, 'module')
shutil.rmtree(submodule_path)
repo.git.add([submodule_path])
repo.index.commit("remove submodule")

repo = git.Repo(repo_path)
assert len(repo.submodules) == 0

@skipIf(HIDE_WINDOWS_KNOWN_ERRORS,
"""FIXME on cygwin: File "C:\\projects\\gitpython\\git\\cmd.py", line 671, in execute
raise GitCommandError(command, status, stderr_value, stdout_value)
Expand Down

[8]ページ先頭

©2009-2026 Movatter.jp