emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#19337: closed ([PATCH] Improve git hook checking c


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#19337: closed ([PATCH] Improve git hook checking commit message.)
Date: Thu, 11 Dec 2014 04:48:01 +0000

Your message dated Wed, 10 Dec 2014 20:47:14 -0800
with message-id <address@hidden>
and subject line Re: [PATCH] Improve git hook checking commit message.
has caused the debbugs.gnu.org bug report #19337,
regarding [PATCH] Improve git hook checking commit message.
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
19337: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19337
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: [PATCH] Improve git hook checking commit message. Date: Wed, 10 Dec 2014 18:24:09 +0100
From: Michal Nazarewicz <address@hidden>

* build-aux/git-hooks/commit-msg: Do not validate commit message if it
starts with “fixup!” or “squash!”.  Those are special markers used by
git when doing auto squashing and as a result the commit message will
not be used in the final commit.

* build-aux/git-hooks/commit-msg: Make the massages somehow more
ambiguous by mentioning that they error has been found in the commit
message.  Otherwise, user may be left wondering what the error is
referring to.
---
 build-aux/git-hooks/commit-msg | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/build-aux/git-hooks/commit-msg b/build-aux/git-hooks/commit-msg
index 6a09edd..f3b05db 100755
--- a/build-aux/git-hooks/commit-msg
+++ b/build-aux/git-hooks/commit-msg
@@ -42,7 +42,7 @@ exec awk '
   /^#/ { next }
 
   !/^.*$/ {
-    print "Invalid character (not UTF-8)"
+    print "Commit message contains invalid character (not UTF-8)"
     status = 1
   }
 
@@ -51,38 +51,47 @@ exec awk '
   { nlines++ }
 
   nlines == 1 && /^[[:space:]]/ {
-    print "White space at start of first line"
+    print "Commit message contains white space at start of first line"
     status = 1
   }
 
+  nlines == 1 && /^(fixup|squash)! / {
+    exit status
+  }
+
   nlines == 2 && /[^[:space:]]/ {
-    print "Nonempty second line"
+    print "Commit message must have an empty second line"
+    status = 1
+  }
+
+  /\t/ {
+    print "Use use spaces instead of tabs in commit message"
     status = 1
   }
 
   /[[:cntrl:]]/ {
-    print "Text contains control character; please use spaces instead of tabs"
+    print "Commit message contains control character"
     status = 1
   }
 
   72 < length && /[[:space:]]/ {
-    print "Line longer than 72 characters"
+    print "Commit message contains line longer than 72 characters"
     status = 1
   }
 
   140 < length {
-    print "Word longer than 140 characters"
+    print "Commit message contains word longer than 140 characters"
     status = 1
   }
 
   /^Signed-off-by: / {
-    print "'Signed-off-by:' present"
+    print "'Signed-off-by:' present in the commit message"
     status = 1
   }
 
   END {
     if (nlines == 0) {
-      print "Empty change log entry"
+      print "Empty commit message"
       status = 1
     }
     exit status
-- 
2.2.0.rc0.207.ga3a616c




--- End Message ---
--- Begin Message --- Subject: Re: [PATCH] Improve git hook checking commit message. Date: Wed, 10 Dec 2014 20:47:14 -0800 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 Thanks for reporting the problem. I installed the attached patch in the emacs-24 branch; it should be merged into the master in due course.

Attachment: 0001-Improve-commit-msg-messages-and-autosquash.patch
Description: Text Data


--- End Message ---

reply via email to

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