Gentoo Archives: gentoo-portage-dev

From: Mike Gilbert <floppym@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] repoman: always add a newline if the message body is one line
Date: Sat, 14 Jan 2017 18:54:24
Message-Id: CAJ0EP40sSuiOBcY5Qh-Sc5LNbfsvf2-rxW=OM=byq+izvfz+LQ@mail.gmail.com
In Reply to: Re: [gentoo-portage-dev] [PATCH] repoman: always add a newline if the message body is one line by Zac Medico
1 On Sat, Jan 14, 2017 at 1:11 PM, Zac Medico <zmedico@g.o> wrote:
2 > On 01/14/2017 08:58 AM, Mike Gilbert wrote:
3 >> The second line in a git commit message is supposed to be blank.
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 | 5 +++--
15 >> 1 file changed, 3 insertions(+), 2 deletions(-)
16 >>
17 >> diff --git a/repoman/pym/repoman/actions.py b/repoman/pym/repoman/actions.py
18 >> index 58b00d494..82c76b2fb 100644
19 >> --- a/repoman/pym/repoman/actions.py
20 >> +++ b/repoman/pym/repoman/actions.py
21 >> @@ -128,8 +128,9 @@ class Actions(object):
22 >> myupdates, mymanifests, myremoved, mychanged, myautoadd,
23 >> mynew, commitmessage)
24 >>
25 >> - lastline = commitmessage.splitlines()[-1]
26 >> - if not ':' in lastline:
27 >> + lines = commitmessage.splitlines()
28 >> + lastline = lines[-1]
29 >> + if len(lines) == 1 or not ':' in lastline:
30 >
31 > Maybe a regular expression would be better, like this:
32 >
33 > if len(lines) == 1 or re.match(r'^\S+:\s', lastline) is None:
34 >
35
36 Sure, I'll make that change (and add the re import).