diff options
author | Kees Cook <keescook@chromium.org> | 2021-12-02 15:38:35 -0800 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2021-12-13 17:28:51 -0500 |
commit | 8998144862b16cfa7a2ec07757d43ca269d59373 (patch) | |
tree | f7a0b0e28ff598c86e09ca02fbc4791c31f0511b | |
parent | 6fc2e91a876b0a2771eedb0fe6106d7f47eb8aab (diff) | |
download | korg-helpers-8998144862b16cfa7a2ec07757d43ca269d59373.tar.gz |
patchwork-bot: Ignore empty context lines
It seems that there is some mismatch in diff output (or storage?) between
git and patchwork under conditions I haven't figured out (MUA or MTA
whitespace stripping?): patchwork appears to ignore empty context lines
(i.e. a line that is only a single space). As a result, the patchwork
hash will not match, and commits will not be identified in patchwork.
As an example of a commit in upstream that patchwork-bot cannot locate
in patchwork due to a different hash, due to the differing empty context
lines:
$ MSGID=20210911102818.3804-1-len.baker@gmx.com
$ wget -qO- https://patchwork.kernel.org/project/linux-hardening/patch/$MSGID/raw/ | \
grep '^ $' | wc -l
0
$ SHA=f11ee2ad25b22c2ee587045dd6999434375532f7
$ git diff ${SHA}~..${SHA} | \
grep '^ $' | wc -l
2
Teaching patchwork-bot to ignore empty context lines allows pwhashes to
match in these cases, which lets those patches get located again.
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Link: https://lore.kernel.org/r/20211202233836.2024510-2-keescook@chromium.org
-rwxr-xr-x | git-patchwork-bot.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/git-patchwork-bot.py b/git-patchwork-bot.py index 2ebe5b4..4e10385 100755 --- a/git-patchwork-bot.py +++ b/git-patchwork-bot.py @@ -528,7 +528,9 @@ def get_patchwork_hash(diff): line_nos = list(map(fn, hunk_match.groups())) line = '@@ -%d +%d @@' % tuple(line_nos) elif line[0] in prefixes: - # if we have a +, - or context line, leave as-is + # if we have a +, - or context line, leave as-is, except blank lines + if line == ' ': + continue pass else: # other lines are ignored |