mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[FIX] runbot_merge: my pager lied to me
Hopefully this is the last fix to the patcher. From the start of the implementation I relied on the idea that `git show` was adding a line composed of a single space (and a newline) before and after the patch message, as that is what I observed in my terminal, and it's consistent with RFC 3676 signatures (two dashes, a space, and a newline). Turns out that single space, while present in my terminal indeed, was completely made up by `less(1)`. `git show` itself doesn't generate that, neither does it appear when using most pagers, or even when piping the output of `less` into something (a file, an other pager, ...). It's pretty much just something `less(1)` sends to a terminal during interactive sessions to fuck with you. Fixes #1037
This commit is contained in:
parent
7d5c3dcb73
commit
f900eb68b6
@ -75,11 +75,11 @@ def parse_show(p: Patch) -> ParseResult:
|
||||
f"found {header}.\nOnly 'medium' and 'fuller' formats are supported")
|
||||
|
||||
# skip possible extra headers before the message
|
||||
while next(lines, ' \n') != ' \n':
|
||||
while not next(lines, ' ').isspace():
|
||||
continue
|
||||
|
||||
body = []
|
||||
while (l := next(lines, ' \n')) != ' \n':
|
||||
while (l := next(lines, '')) and l.startswith(' '):
|
||||
body.append(l.removeprefix(' '))
|
||||
|
||||
# remainder should be the patch
|
||||
|
@ -9,11 +9,11 @@ BASIC_UDIFF = """\
|
||||
commit 0000000000000000000000000000000000000000
|
||||
Author: 3 Discos Down <bar@example.org>
|
||||
Date: 2021-04-24T17:09:14Z
|
||||
|
||||
|
||||
whop
|
||||
|
||||
whop whop
|
||||
|
||||
|
||||
diff --git a/b b/b
|
||||
index 000000000000..000000000000 100644
|
||||
--- a/b
|
||||
|
Loading…
Reference in New Issue
Block a user