aboutsummaryrefslogtreecommitdiffhomepage
path: root/git-dch
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2010-07-21 18:26:29 +0200
committerGuido Günther <agx@sigxcpu.org>2010-07-21 18:33:18 +0200
commit28082073975466b8af17c7ff55bd8da9b54ea5ff (patch)
treef78a8881ed7c078ac2bc4715f3d176e6ed17feaf /git-dch
parent8c8167f96e85cd4a7d2fddb904596f85de0da23a (diff)
Terminate the patch description with a dot
in case of multiline commits where the second line starts with a uppercase letter. Heavily based on a patch by Jonathan Nieder.
Diffstat (limited to 'git-dch')
-rwxr-xr-xgit-dch22
1 files changed, 21 insertions, 1 deletions
diff --git a/git-dch b/git-dch
index 501d1b9d..07c9179c 100755
--- a/git-dch
+++ b/git-dch
@@ -46,6 +46,23 @@ def system(cmd):
def escape_commit(msg):
return msg.replace('"','\\\"').replace("$","\$").replace("`","\`")
+def ispunct(ch):
+ return not ch.isalnum() and not ch.isspace()
+
+def punctuate_commit(msg):
+ """Terminate the first line of a commit message with a '.' if it's a
+ multiline commit"""
+ lines = msg.split('\n', 1)
+ if len(lines) <= 1:
+ return msg
+ first, rest = lines
+ if not rest:
+ return msg
+ if first and ispunct(first[-1]):
+ return msg
+ if rest[0].islower():
+ return msg
+ return "%s.\n%s" % (first, rest)
def spawn_dch(msg='', author=None, email=None, newversion=False, version=None, release=False, distribution=None):
distopt = ""
@@ -61,6 +78,9 @@ def spawn_dch(msg='', author=None, email=None, newversion=False, version=None, r
versionopt = "--release --no-force-save-on-release"
msg = None
+ if msg:
+ msg = punctuate_commit(msg)
+
if author and email:
env = """DEBFULLNAME="%s" DEBEMAIL="%s" """ % (author, email)
@@ -74,7 +94,7 @@ def spawn_dch(msg='', author=None, email=None, newversion=False, version=None, r
def add_changelog_entry(msg, author, email):
- "add aa single changelog entry"
+ "add a single changelog entry"
spawn_dch(msg=msg, author=author, email=email)