]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
gitchangelog: don't break lines on hyphens in relnotes
authorNicki Křížek <nicki@isc.org>
Mon, 2 Dec 2024 10:10:01 +0000 (11:10 +0100)
committerNicki Křížek <nicki@isc.org>
Mon, 2 Dec 2024 10:10:01 +0000 (11:10 +0100)
When release notes are generated, the text is wrapped and line breaks
are inserted into each paragraph (sourced from the commit message's
body). Prevent line breaks after hyphens, as these are often used for
option names. This makes it possible to easily find the options
afterwards.

contrib/gitchangelog/gitchangelog.py

index b466c38c709418f6af3fa8e31934f08c89cd4a10..7d22fe483d5ccf4b7ef364d9db18b139035572e9 100755 (executable)
@@ -561,7 +561,8 @@ def paragraph_wrap(text, regexp="\n\n", separator="\n"):
     """
     regexp = re.compile(regexp, re.MULTILINE)
     return separator.join(
-        "\n".join(textwrap.wrap(paragraph.strip())) for paragraph in regexp.split(text)
+        "\n".join(textwrap.wrap(paragraph.strip(), break_on_hyphens=False))
+        for paragraph in regexp.split(text)
     ).strip()
 
 
@@ -1514,7 +1515,12 @@ def rest_py(data, opts={}):
         if opts["include_commit_sha"]:
             subject += " ``%s``" % commit["commit"].sha1_short
 
-        entry = indent("\n".join(textwrap.wrap(subject)), first="- ").strip() + "\n"
+        entry = (
+            indent(
+                "\n".join(textwrap.wrap(subject, break_on_hyphens=False)), first="- "
+            ).strip()
+            + "\n"
+        )
 
         if commit["body"]:
             entry += "\n" + indent(commit["body"])