summaryrefslogtreecommitdiff
path: root/tools/verifygitlog.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/verifygitlog.py')
-rwxr-xr-xtools/verifygitlog.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/verifygitlog.py b/tools/verifygitlog.py
index 67215d5c5..523461198 100755
--- a/tools/verifygitlog.py
+++ b/tools/verifygitlog.py
@@ -96,6 +96,9 @@ def verify_message_body(raw_body, err):
if len(subject_line) >= 73:
err.error("Subject line must be 72 or fewer characters: " + subject_line)
+ # Do additional checks on the prefix of the subject line.
+ verify_subject_line_prefix(subject_line.split(": ")[0], err)
+
# Second one divides subject and body.
if len(raw_body) > 1 and raw_body[1]:
err.error("Second message line must be empty: " + raw_body[1])
@@ -110,6 +113,26 @@ def verify_message_body(raw_body, err):
err.error('Message must be signed-off. Use "git commit -s".')
+def verify_subject_line_prefix(prefix, err):
+ ext = (".c", ".h", ".cpp", ".js", ".rst", ".md")
+
+ if prefix.startswith("."):
+ err.error('Subject prefix cannot begin with ".".')
+
+ if prefix.endswith("/"):
+ err.error('Subject prefix cannot end with "/".')
+
+ if prefix.startswith("ports/"):
+ err.error(
+ 'Subject prefix cannot begin with "ports/", start with the name of the port instead.'
+ )
+
+ if prefix.endswith(ext):
+ err.error(
+ "Subject prefix cannot end with a file extension, use the main part of the filename without the extension."
+ )
+
+
def run(args):
verbose("run", *args)