summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgit-check-commit-msg/git-check-commit-msg8
1 files changed, 8 insertions, 0 deletions
diff --git a/git-check-commit-msg/git-check-commit-msg b/git-check-commit-msg/git-check-commit-msg
index 060fced..ae6d3ff 100755
--- a/git-check-commit-msg/git-check-commit-msg
+++ b/git-check-commit-msg/git-check-commit-msg
@@ -1,9 +1,15 @@
#!/bin/sh
+# FIXME: Save the commit message somewhere?
+# $ git commit -F .git/COMMIT_EDITMSG
+# Results in an empty commit message in this run.
msgfile="$1"
+common="You might want to fix this and retry the commit."
+
test -s "$msgfile" || {
echo >&2 "Commit message must NOT be empty."
+ echo >&2 "$common"
exit 1
}
@@ -12,10 +18,12 @@ test "x$(sed -n '1s/^.\{,50\}//p' "$msgfile")" = "x" || {
echo >&2 "First line is too long. It should be <= 50 characters."
echo >&2 "These characters fit: $(sed -n '1s/^\(.\{,50\}\)\(.*\)$/\1/p' "$1")"
echo >&2 "These exceed the limit: $(sed -n '1s/^\(.\{,50\}\)\(.*\)$/\2/p' "$1")"
+ echo >&2 "$common"
exit 1
}
test "x$(sed -n 's/^#.*//; 2p' "$msgfile")" = "x" || {
echo >&2 "Second line should be empty."
+ echo >&2 "$common"
exit 1
}