Re: [gentoo-portage-dev] [PATCH v2] repoman: always add a newline if the message body is one line
On 01/14/2017 11:00 AM, Mike Gilbert wrote: > The second line in a git commit message is supposed to be blank. > Also, use a regex to more exactly match a Field: value line. > > Before: > dev-libs/libfoo: fix another bug > Package-Manager: Portage-2.3.3, Repoman-2.3.1 > > After: > dev-libs/libfoo: fix another bug > > Package-Manager: Portage-2.3.3, Repoman-2.3.1 > --- > repoman/pym/repoman/actions.py | 6 -- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/repoman/pym/repoman/actions.py b/repoman/pym/repoman/actions.py > index 58b00d494..6b0c6459d 100644 > --- a/repoman/pym/repoman/actions.py > +++ b/repoman/pym/repoman/actions.py > @@ -6,6 +6,7 @@ import errno > import io > import logging > import platform > +import re > import signal > import sys > import tempfile > @@ -128,8 +129,9 @@ class Actions(object): > myupdates, mymanifests, myremoved, > mychanged, myautoadd, > mynew, commitmessage) > > - lastline = commitmessage.splitlines()[-1] > - if not ':' in lastline: > + lines = commitmessage.splitlines() > + lastline = lines[-1] > + if len(lines) == 1 or re.match(r'^\S+:\s', lastline) is None: > commitmessage += '\n' > > commit_footer = self.get_commit_footer() > LGTM. Thanks! -- Thanks, Zac
[gentoo-portage-dev] [PATCH v2] repoman: always add a newline if the message body is one line
The second line in a git commit message is supposed to be blank. Also, use a regex to more exactly match a Field: value line. Before: dev-libs/libfoo: fix another bug Package-Manager: Portage-2.3.3, Repoman-2.3.1 After: dev-libs/libfoo: fix another bug Package-Manager: Portage-2.3.3, Repoman-2.3.1 --- repoman/pym/repoman/actions.py | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/repoman/pym/repoman/actions.py b/repoman/pym/repoman/actions.py index 58b00d494..6b0c6459d 100644 --- a/repoman/pym/repoman/actions.py +++ b/repoman/pym/repoman/actions.py @@ -6,6 +6,7 @@ import errno import io import logging import platform +import re import signal import sys import tempfile @@ -128,8 +129,9 @@ class Actions(object): myupdates, mymanifests, myremoved, mychanged, myautoadd, mynew, commitmessage) - lastline = commitmessage.splitlines()[-1] - if not ':' in lastline: + lines = commitmessage.splitlines() + lastline = lines[-1] + if len(lines) == 1 or re.match(r'^\S+:\s', lastline) is None: commitmessage += '\n' commit_footer = self.get_commit_footer() -- 2.11.0