aboutsummaryrefslogtreecommitdiffstats
path: root/tools/validate-commit.py
diff options
context:
space:
mode:
authorJoerg Mayer <jmayer@loplof.de>2021-06-11 16:43:05 +0200
committerJoerg Mayer <jmayer@loplof.de>2021-06-11 16:46:13 +0200
commit5fc88c671ab569e37000988013284b8a63fe7225 (patch)
tree87a2fcf8be01b87fbc8d3a3e0738a38b44b67dde /tools/validate-commit.py
parentb86ec10ca4e85d40e8103a0f7779b27ab65e4ccf (diff)
Strip comment lines before validating format
Fixes the problem that a one line commit message followed by the default comment lines was rejected.
Diffstat (limited to 'tools/validate-commit.py')
-rwxr-xr-xtools/validate-commit.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/validate-commit.py b/tools/validate-commit.py
index 1c62561aa9..cf4980beb9 100755
--- a/tools/validate-commit.py
+++ b/tools/validate-commit.py
@@ -21,6 +21,7 @@ import subprocess
import sys
import tempfile
import urllib.request
+import re
parser = argparse.ArgumentParser()
@@ -109,7 +110,8 @@ def extract_subject(subject):
def verify_body(body):
- old_lines = body.splitlines(True)
+ bodynocomments = re.sub('^#.*$', '', body, flags=re.MULTILINE)
+ old_lines = bodynocomments.splitlines(True)
is_good = True
if len(old_lines) >= 2 and old_lines[1].strip():
print('ERROR: missing blank line after the first subject line.')