Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork962
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
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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: | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe 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). ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. Member There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
| # The submodule doesn't exist, probably it wasn't | ||
| # removed from the .gitmodules file. | ||
| continue | ||
| # END handle keyerror | ||
| # END handle critical error | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
| @@ -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 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 ) | ||
| @@ -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): | ||
Byron marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| 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) | ||