Commit 2a4b7c00 authored by locallycompact-ct's avatar locallycompact-ct

Stop submodule error hiding, parse as unicode

parent d463a1bd
......@@ -265,29 +265,24 @@ def checkout_submodules(dn):
url = parser.get(section, 'url')
app.log(dn, 'WARNING: fallback to submodule %s from' % path, url)
try:
# list objects in the parent repo tree to find the commit
# object that corresponds to the submodule
commit = check_output(['git', 'ls-tree', dn['ref'], path])
# read the commit hash from the output
fields = commit.split()
if len(fields) >= 2 and fields[1] == 'commit':
submodule_commit = commit.split()[2]
# list objects in the parent repo tree to find the commit
# object that corresponds to the submodule
commit = check_output(['git', 'ls-tree', dn['ref'], path]).split()
# fail if the commit hash is invalid
if len(submodule_commit) != 40:
raise Exception
# read the commit hash from the output
fields = list(map(lambda x: x.decode('unicode-escape'), commit))
if len(fields) >= 2 and fields[1] == 'commit':
submodule_commit = fields[2]
fulldir = os.path.join(os.getcwd(), path)
_checkout(dn['name'], url, submodule_commit, fulldir)
# fail if the commit hash is invalid
if len(submodule_commit) != 40:
raise Exception
else:
app.log(dn, 'Skipping submodule %s, not a commit:' % path,
fields)
fulldir = os.path.join(os.getcwd(), path)
_checkout(dn['name'], url, submodule_commit, fulldir)
except:
app.log(dn, "Git submodules problem", exit=True)
else:
app.log(dn, 'Skipping submodule %s, not a commit:' % path, fields)
@contextlib.contextmanager
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment