Strip comment lines before validating format

Fixes the problem that a one line commit message followed by the default
comment lines was rejected.
This commit is contained in:
Joerg Mayer 2021-06-11 16:43:05 +02:00
parent b86ec10ca4
commit 5fc88c671a
1 changed files with 3 additions and 1 deletions

View File

@ -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.')