[PATCH v3 4/4] guess_git_tree: fix crash caused by empty diff
ohilyard at iol.unh.edu
ohilyard at iol.unh.edu
Tue Feb 1 22:35:45 CET 2022
From: Owen Hilyard <ohilyard at iol.unh.edu>
A sanity check has been added to find_filenames. Occasionally, due to
how the community lab internally handles getting patches from
patchworks, a patch will result in no diff. This patch adds handling for
this case.
Signed-off-by: Owen Hilyard <ohilyard at iol.unh.edu>
---
tools/pw_maintainers_cli.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/pw_maintainers_cli.py b/tools/pw_maintainers_cli.py
index 0705eee..975b62b 100755
--- a/tools/pw_maintainers_cli.py
+++ b/tools/pw_maintainers_cli.py
@@ -124,6 +124,11 @@ class Diff(object):
- Moved _filename_re into the method.
- Reduced newlines.
"""
+ # sanity check diff
+ # for patches without any diff, it will try to run diff.replace
+ # while diff is None. just return an empty list
+ if diff is None:
+ return []
_filename_re = re.compile(r'^(---|\+\+\+) (\S+)')
# normalise spaces
diff = diff.replace('\r', '')
--
2.30.2
More information about the ci
mailing list