coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] maint: prevent trailing period at first line of a commit message


From: Bernhard Voelker
Subject: [PATCH] maint: prevent trailing period at first line of a commit message
Date: Thu, 14 Feb 2013 00:45:27 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130105 Thunderbird/17.0.2

In coreutils, we do not use a period '.' at the end of the
first line of a commit message. The patch below changes the
git hook to make it easier to follow this rule.

This becomes active by running ./bootstrap which copies
the commit-msg script to ".git/hooks/".

Do you thinks it's worth adding?

Have a nice day,
Berny


>From 90b5a51b7d89a3365b1db01a7e8a930f0006cf31 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <address@hidden>
Date: Thu, 14 Feb 2013 00:28:06 +0100
Subject: [PATCH] maint: prevent trailing period at first line of a commit
 message

* scripts/git-hooks/commit-msg (bad_first_line): Return an error
message if the first line of a commit message ends with a period.
---
 scripts/git-hooks/commit-msg |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/scripts/git-hooks/commit-msg b/scripts/git-hooks/commit-msg
index 1732103..3e91e8e 100755
--- a/scripts/git-hooks/commit-msg
+++ b/scripts/git-hooks/commit-msg
@@ -62,6 +62,9 @@ sub bad_first_line($)
   $line =~ /:/
     or return 'missing colon on first line of log message';

+  $line =~ /\.$/
+    and return 'do not use a period "." at the end of the first line';
+
   # The token(s) before the colon on the first line must be on our list
   # Tokens may be space- or comma-separated.
   (my $pre_colon = $line) =~ s/:.*//;
-- 
1.7.7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]