Fix: Handle utf-8 decode errors when parsing commits
diff --git a/git.py b/git.py
index 505ff6c..7de1dd4 100644
--- a/git.py
+++ b/git.py
@@ -144,9 +144,12 @@
def build_path_to_bug_list_map(git: Git, bug_fix_checker: BugFixChecker) -> PathToBugListMap:
path_to_bug_lists = PathToBugListMap()
for commit_hash in find_bug_fixes(git, bug_fix_checker):
- commit = git.show(commit_hash)
- paths = find_affected_files_in_commit(commit)
- path_to_bug_lists.add_bug_to_paths(paths, commit_hash)
+ try:
+ commit = git.show(commit_hash)
+ paths = find_affected_files_in_commit(commit)
+ path_to_bug_lists.add_bug_to_paths(paths, commit_hash)
+ except UnicodeDecodeError as e:
+ logging.exception('Failed to show commit for %s, %s', commit_hash, e)
return path_to_bug_lists
def generate_path_to_bug_list(git: Git, path_to_bug_list_file: str, bug_fix_checker=UpstreamKernelBugFixChecker()) -> None: