##// END OF EJS Templates
git: fix submodule handling for git repositories
super-admin -
r5126:de59bf70 default
parent child Browse files
Show More
@@ -20,6 +20,7 b''
20 GIT commit module
20 GIT commit module
21 """
21 """
22
22
23 import io
23 import stat
24 import stat
24 import configparser
25 import configparser
25 from itertools import chain
26 from itertools import chain
@@ -309,16 +310,16 b' class GitCommit(base.BaseCommit):'
309 filenodes = []
310 filenodes = []
310
311
311 # extracted tree ID gives us our files...
312 # extracted tree ID gives us our files...
312 bytes_path = safe_str(path) # libgit operates on bytes
313 str_path = safe_str(path) # libgit operates on bytes
313 for name, stat_, id_, type_ in self._remote.tree_items(tree_id):
314 for name, stat_, id_, type_ in self._remote.tree_items(tree_id):
314 if type_ == 'link':
315 if type_ == 'link':
315 url = self._get_submodule_url('/'.join((bytes_path, name)))
316 url = self._get_submodule_url('/'.join((str_path, name)))
316 dirnodes.append(SubModuleNode(
317 dirnodes.append(SubModuleNode(
317 name, url=url, commit=id_, alias=self.repository.alias))
318 name, url=url, commit=id_, alias=self.repository.alias))
318 continue
319 continue
319
320
320 if bytes_path != '':
321 if str_path != '':
321 obj_path = '/'.join((bytes_path, name))
322 obj_path = '/'.join((str_path, name))
322 else:
323 else:
323 obj_path = name
324 obj_path = name
324 if obj_path not in self._stat_modes:
325 if obj_path not in self._stat_modes:
@@ -471,13 +472,8 b' class GitCommit(base.BaseCommit):'
471 except NodeDoesNotExistError:
472 except NodeDoesNotExistError:
472 return None
473 return None
473
474
474 # ConfigParser fails if there are whitespaces, also it needs an iterable
475 # file like content
476 def iter_content(_content):
477 yield from _content.splitlines()
478
479 parser = configparser.RawConfigParser()
475 parser = configparser.RawConfigParser()
480 parser.read_file(iter_content(submodules_node.content))
476 parser.read_file(io.StringIO(submodules_node.str_content))
481
477
482 for section in parser.sections():
478 for section in parser.sections():
483 path = parser.get(section, 'path')
479 path = parser.get(section, 'path')
General Comments 0
You need to be logged in to leave comments. Login now