Gentoo Archives: gentoo-portage-dev

From: Mike Gilbert <floppym@g.o>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] [PATCH v2] repoman: always add a newline if the message body is one line
Date: Sat, 14 Jan 2017 19:00:12
Message-Id: 20170114190005.3408-1-floppym@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 The second line in a git commit message is supposed to be blank.
2 Also, use a regex to more exactly match a Field: value line.
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 | 6 ++++--
14 1 file changed, 4 insertions(+), 2 deletions(-)
15
16 diff --git a/repoman/pym/repoman/actions.py b/repoman/pym/repoman/actions.py
17 index 58b00d494..6b0c6459d 100644
18 --- a/repoman/pym/repoman/actions.py
19 +++ b/repoman/pym/repoman/actions.py
20 @@ -6,6 +6,7 @@ import errno
21 import io
22 import logging
23 import platform
24 +import re
25 import signal
26 import sys
27 import tempfile
28 @@ -128,8 +129,9 @@ class Actions(object):
29 myupdates, mymanifests, myremoved, mychanged, myautoadd,
30 mynew, commitmessage)
31
32 - lastline = commitmessage.splitlines()[-1]
33 - if not ':' in lastline:
34 + lines = commitmessage.splitlines()
35 + lastline = lines[-1]
36 + if len(lines) == 1 or re.match(r'^\S+:\s', lastline) is None:
37 commitmessage += '\n'
38
39 commit_footer = self.get_commit_footer()
40 --
41 2.11.0

Replies