[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] scripts: allow empty commit messages abort the commit
From: |
Pádraig Brady |
Subject: |
[PATCH] scripts: allow empty commit messages abort the commit |
Date: |
Thu, 26 Jan 2012 01:00:10 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 |
I'm not committing this as it contradicts a comment
in the script, but I think something like this is
needed to allow one to abort a commit normally.
I've gone hunting for my vim process to kill
a couple of times now.
cheers,
Pádraig.
commit bdd5930b87071bcda32f92d3c8798d0e1a91f966
Author: Pádraig Brady <address@hidden>
Date: Thu Jan 26 00:55:55 2012 +0000
scripts: allow empty commit messages abort the commit
* scripts/git-hooks/commit-msg: Validate empty commit
messages, so that git will abort the commit as normal.
diff --git a/scripts/git-hooks/commit-msg b/scripts/git-hooks/commit-msg
index e1bb382..4a0a6b9 100755
--- a/scripts/git-hooks/commit-msg
+++ b/scripts/git-hooks/commit-msg
@@ -95,13 +95,13 @@ sub check_msg($$)
# with lines that start with "#" in the log.
# Filter out leading blank and comment lines.
- # while (@line && $line[0] =~ /^(?:#.*|[ \t]*)$/) { shift @line; }
+ while (@line && $line[0] =~ /^(?:#.*|[ \t]*)$/) { shift @line; }
# Filter out blank and comment lines at EOF.
- # while (@line && $line[$#line] =~ /^(?:#.*|[ \t]*)$/) { pop @line; }
+ while (@line && $line[$#line] =~ /^(?:#.*|[ \t]*)$/) { pop @line; }
@line == 0
- and return 'no log message';
+ and return ''; # let git abort
my $bad = bad_first_line $line[0];
$bad
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] scripts: allow empty commit messages abort the commit,
Pádraig Brady <=