[PATCH V2] Prefer patch subject/author when they're specified in the body of the email

Peter Maydell peter.maydell at linaro.org
Fri May 13 18:22:21 EST 2011

On 13 May 2011 09:39, Guilherme Salgado <guilherme.salgado at linaro.org> wrote:
> To be consistent with git-am, use the subject (extracted from the first line,
> when it begins with 'Subject:') and the author (extracted from the first or
> second line, when it begins with 'From:') and use that as Patch.name and
> Patch.author respectively.  For more details on the exact format that is
> supported, check git-am's manpage.

git am lets you put the lines in the order From: then Subject: as well
as Subject: then From:, which this commit message suggests your patch
doesn't allow.

+def find_author(comment):
+    if first_line.startswith('From:'):
+        author_line = first_line
+    elif (first_line.startswith('Subject:') and
+          second_line.startswith('From:')):
+        author_line = second_line

It seems kind of ugly that find_author() has to explicitly know
about the complete set of header lines that we're happy to extract
from the body. This just about works for two header lines, but
I think it would quickly get unwieldy if we get to three or four
headers which might all be in any order...

-- PMM

More information about the Patchwork mailing list