Skip submodules
If submodule used to be in history but since then was deleted, `git show <commit>:submodule_path` would produce `bad object` error as no info about given submodule can be found in HEAD.
This commit is contained in:
parent
274a8b88ba
commit
5361175f82
|
@ -123,9 +123,10 @@ PROGRESS_TEXT = N_("Checking how many rows belong to each author (2 of 2): {0:.0
|
|||
class Blame(object):
|
||||
def __init__(self, repo, hard, useweeks, changes):
|
||||
self.blames = {}
|
||||
ls_tree_r = subprocess.Popen(["git", "ls-tree", "--name-only", "-r", changes.ref], bufsize=1,
|
||||
ls_tree_r = subprocess.Popen(["git", "ls-tree", "-r", changes.ref], bufsize=1,
|
||||
stdout=subprocess.PIPE).stdout
|
||||
lines = ls_tree_r.readlines()
|
||||
# skip submodules
|
||||
lines = [ l.split("\t",1)[-1] for l in ls_tree_r.readlines() if not l.startswith("160000") ]
|
||||
ls_tree_r.close()
|
||||
|
||||
progress_text = _(PROGRESS_TEXT)
|
||||
|
|
|
@ -44,10 +44,14 @@ class MetricsLogic(object):
|
|||
self.cyclomatic_complexity = {}
|
||||
self.cyclomatic_complexity_density = {}
|
||||
|
||||
ls_tree_r = subprocess.Popen(["git", "ls-tree", "--name-only", "-r", ref], bufsize=1,
|
||||
ls_tree_r = subprocess.Popen(["git", "ls-tree", "-r", ref], bufsize=1,
|
||||
stdout=subprocess.PIPE).stdout
|
||||
|
||||
|
||||
|
||||
for i in ls_tree_r.readlines():
|
||||
if i.startswith("160000"): continue # skip submodules
|
||||
i = i.split("\t")[-1]
|
||||
i = i.strip().decode("unicode_escape", "ignore")
|
||||
i = i.encode("latin-1", "replace")
|
||||
i = i.decode("utf-8", "replace").strip("\"").strip("'").strip()
|
||||
|
|
Loading…
Reference in New Issue