Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH v2] repoman: always add a newline if the message body is one line
Date: Sat, 14 Jan 2017 19:04:10
Message-Id: a0c01d14-1469-7f8b-6056-47f9ac65e322@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH v2] repoman: always add a newline if the message body is one line by Mike Gilbert
1 On 01/14/2017 11:00 AM, Mike Gilbert wrote:
2 > The second line in a git commit message is supposed to be blank.
3 > Also, use a regex to more exactly match a Field: value line.
4 >
5 > Before:
6 > dev-libs/libfoo: fix another bug
7 > Package-Manager: Portage-2.3.3, Repoman-2.3.1
8 >
9 > After:
10 > dev-libs/libfoo: fix another bug
11 >
12 > Package-Manager: Portage-2.3.3, Repoman-2.3.1
13 > ---
14 > repoman/pym/repoman/actions.py | 6 ++++--
15 > 1 file changed, 4 insertions(+), 2 deletions(-)
16 >
17 > diff --git a/repoman/pym/repoman/actions.py b/repoman/pym/repoman/actions.py
18 > index 58b00d494..6b0c6459d 100644
19 > --- a/repoman/pym/repoman/actions.py
20 > +++ b/repoman/pym/repoman/actions.py
21 > @@ -6,6 +6,7 @@ import errno
22 > import io
23 > import logging
24 > import platform
25 > +import re
26 > import signal
27 > import sys
28 > import tempfile
29 > @@ -128,8 +129,9 @@ class Actions(object):
30 > myupdates, mymanifests, myremoved, mychanged, myautoadd,
31 > mynew, commitmessage)
32 >
33 > - lastline = commitmessage.splitlines()[-1]
34 > - if not ':' in lastline:
35 > + lines = commitmessage.splitlines()
36 > + lastline = lines[-1]
37 > + if len(lines) == 1 or re.match(r'^\S+:\s', lastline) is None:
38 > commitmessage += '\n'
39 >
40 > commit_footer = self.get_commit_footer()
41 >
42
43 LGTM. Thanks!
44 --
45 Thanks,
46 Zac