Relax git_footers parsing to match that of Gerrit (JGit).

R=agable@chromium.org

Bug: 717504
Change-Id: Ieb6415d55e85b91f11f9052b0fd08cf982b64d51
Reviewed-on: https://chromium-review.googlesource.com/501849
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
This commit is contained in:
Andrii Shyshkalov
2017-05-10 19:37:18 +02:00
committed by Commit Bot
parent 8e4576f385
commit 28a5d5defd
3 changed files with 34 additions and 5 deletions

View File

@@ -48,6 +48,8 @@ def split_footers(message):
Guarantees that:
(non_footer_lines + footer_lines) == message.splitlines().
parsed_footers is parse_footer applied on each line of footer_lines.
There could be fewer parsed_footers than footer lines if some lines in
last paragraph are malformed.
"""
message_lines = list(message.splitlines())
footer_lines = []
@@ -61,8 +63,8 @@ def split_footers(message):
footer_lines = []
footer_lines.reverse()
footers = map(parse_footer, footer_lines)
if not footer_lines or not all(footers):
footers = filter(None, map(parse_footer, footer_lines))
if not footers:
return message_lines, [], []
return message_lines[:-len(footer_lines)], footer_lines, footers