treewide: Update prepare-commit-msg hook to strip prog/lang-* prefix

This behavior was documented in script documentation, but wasn't implemented
before.
This commit is contained in:
Dmitry Bogatov 2023-09-10 00:29:57 -04:00
parent 8667928217
commit 74abbab2dc

View File

@ -24,6 +24,7 @@ count the sub-project prefix.
"""
import sys
import re
from os.path import commonpath, dirname, exists, join as joinpath
from subprocess import check_output
args = {ix: value for ix, value in enumerate(sys.argv)}
@ -68,7 +69,8 @@ with open(message_file, "w") as output:
if common:
output.write(f"{common}: \n\n")
prefix = re.sub("prog/lang-[a-z]+/", "", common)
output.write(f"{prefix}: \n\n")
else:
output.write("treewide: \n\n")