Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@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:11:20
Message-Id: ec78b0a3-e155-84ae-cddb-90458940e572@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] repoman: always add a newline if the message body is one line by Mike Gilbert
1 On 01/14/2017 08:58 AM, Mike Gilbert wrote:
2 > The second line in a git commit message is supposed to be blank.
3 >
4 > Before:
5 > dev-libs/libfoo: fix another bug
6 > Package-Manager: Portage-2.3.3, Repoman-2.3.1
7 >
8 > After:
9 > dev-libs/libfoo: fix another bug
10 >
11 > Package-Manager: Portage-2.3.3, Repoman-2.3.1
12 > ---
13 > repoman/pym/repoman/actions.py | 5 +++--
14 > 1 file changed, 3 insertions(+), 2 deletions(-)
15 >
16 > diff --git a/repoman/pym/repoman/actions.py b/repoman/pym/repoman/actions.py
17 > index 58b00d494..82c76b2fb 100644
18 > --- a/repoman/pym/repoman/actions.py
19 > +++ b/repoman/pym/repoman/actions.py
20 > @@ -128,8 +128,9 @@ class Actions(object):
21 > myupdates, mymanifests, myremoved, mychanged, myautoadd,
22 > mynew, commitmessage)
23 >
24 > - lastline = commitmessage.splitlines()[-1]
25 > - if not ':' in lastline:
26 > + lines = commitmessage.splitlines()
27 > + lastline = lines[-1]
28 > + if len(lines) == 1 or not ':' in lastline:
29
30 Maybe a regular expression would be better, like this:
31
32 if len(lines) == 1 or re.match(r'^\S+:\s', lastline) is None:
33
34
35 > commitmessage += '\n'
36 >
37 > commit_footer = self.get_commit_footer()
38 >
39
40
41 --
42 Thanks,
43 Zac

Replies