From 5fc88c671ab569e37000988013284b8a63fe7225 Mon Sep 17 00:00:00 2001 From: Joerg Mayer Date: Fri, 11 Jun 2021 16:43:05 +0200 Subject: [PATCH] Strip comment lines before validating format Fixes the problem that a one line commit message followed by the default comment lines was rejected. --- tools/validate-commit.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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.')