diff mbox series

[ovs-dev,2/2] checkpatch: Only consider certain signoffs

Message ID 20180620184058.15838-2-aconole@redhat.com
State Accepted
Headers show
Series [ovs-dev,1/2] checkpatch: add quiet option | expand

Commit Message

Aaron Conole June 20, 2018, 6:40 p.m. UTC
Formatted patches can contain a heirarchy of sign-offs.  This is true when
merging patches from different projects (eg. backports to the datapath
directory from the linux net project).

This means that a submitted backport will contain multiple signed-off
tags, and not all should be considered.

This commit updates checkpatch to only consider those signoff lines which
start at the beginning of a line.  So the following:

  Signed-off-by: Foo Bar <foo@bar.com>

should not trigger.

Signed-off-by: Aaron Conole <aconole@redhat.com>
---
 utilities/checkpatch.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
index cd781b576..5a6d5f5ff 100755
--- a/utilities/checkpatch.py
+++ b/utilities/checkpatch.py
@@ -623,9 +623,9 @@  def ovs_checkpatch_parse(text, filename):
     hunks = re.compile('^(---|\+\+\+) (\S+)')
     hunk_differences = re.compile(
         r'^@@ ([0-9-+]+),([0-9-+]+) ([0-9-+]+),([0-9-+]+) @@')
-    is_signature = re.compile(r'((\s*Signed-off-by: )(.*))$',
+    is_signature = re.compile(r'^(Signed-off-by: )(.*)$',
                               re.I | re.M | re.S)
-    is_co_author = re.compile(r'(\s*(Co-authored-by: )(.*))$',
+    is_co_author = re.compile(r'^(Co-authored-by: )(.*)$',
                               re.I | re.M | re.S)
     is_gerrit_change_id = re.compile(r'(\s*(change-id: )(.*))$',
                                      re.I | re.M | re.S)
@@ -664,10 +664,10 @@  def ovs_checkpatch_parse(text, filename):
                         print_error("Co-authored-by/Signed-off-by corruption")
             elif is_signature.match(line):
                 m = is_signature.match(line)
-                signatures.append(m.group(3))
+                signatures.append(m.group(2))
             elif is_co_author.match(line):
                 m = is_co_author.match(line)
-                co_authors.append(m.group(3))
+                co_authors.append(m.group(2))
             elif is_gerrit_change_id.match(line):
                 print_error(
                     "Remove Gerrit Change-Id's before submitting upstream.")