handle missing commits (shallow clones) in git_version retrieving
This commit is contained in:
parent
d4e42d01f9
commit
34f54e9c25
1 changed files with 8 additions and 7 deletions
|
@ -7,12 +7,13 @@ def get_history(commit: git.objects.commit.Commit, priority=0, depth=0) -> Dict:
|
||||||
'priority': priority,
|
'priority': priority,
|
||||||
'depth': depth
|
'depth': depth
|
||||||
}}
|
}}
|
||||||
if len(commit.parents) == 0:
|
try:
|
||||||
return commit_history
|
if len(commit.parents) > 0:
|
||||||
else:
|
|
||||||
commit_history.update(get_history(commit.parents[0], priority, depth+1))
|
commit_history.update(get_history(commit.parents[0], priority, depth+1))
|
||||||
for parent in commit.parents[1:]:
|
for parent in commit.parents[1:]:
|
||||||
commit_history.update(get_history(parent, priority+1, depth+1))
|
commit_history.update(get_history(parent, priority+1, depth+1))
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
return commit_history
|
return commit_history
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue