Skip to content

BF: use get, not casting get_value while dealing with submodule path/url etc #667

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 21, 2017
Merged
Changes from all 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
10 changes: 5 additions & 5 deletions git/objects/submodule/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ def _set_cache_(self, attr):
reader = self.config_reader()
# default submodule values
try:
self.path = reader.get_value('path')
self.path = reader.get('path')
except cp.NoSectionError:
raise ValueError("This submodule instance does not exist anymore in '%s' file"
% osp.join(self.repo.working_tree_dir, '.gitmodules'))
# end
self._url = reader.get_value('url')
self._url = reader.get('url')
# git-python extension values - optional
self._branch_path = reader.get_value(self.k_head_option, git.Head.to_full_path(self.k_head_default))
elif attr == '_name':
Expand Down Expand Up @@ -1168,11 +1168,11 @@ def iter_items(cls, repo, parent_commit='HEAD'):

for sms in parser.sections():
n = sm_name(sms)
p = parser.get_value(sms, 'path')
u = parser.get_value(sms, 'url')
p = parser.get(sms, 'path')
u = parser.get(sms, 'url')
b = cls.k_head_default
if parser.has_option(sms, cls.k_head_option):
b = str(parser.get_value(sms, cls.k_head_option))
b = str(parser.get(sms, cls.k_head_option))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

could even strip away us of str here... note that get is still advisable instead of get_value since it could cast+str 1.0 to 1 and then false to False.

# END handle optional information

# get the binsha
Expand Down