Commit 7cd62382 authored by Brad King's avatar Brad King
Browse files

commit-msg: Exclude diff during "git commit -v"

Stop processing the commit message text at a "diff --git" line.  Such
lines occur when the user commits with the "-v" option.  We should not
check the patch content; it will be stripped by Git anyway.
parent 0df83855
......@@ -2,9 +2,11 @@
# Copy or link this file as ".git/hooks/pre-commit".
# Prepare a backup message without comments.
# Prepare a copy of the message:
# - strip comment lines
# - stop at "diff --git" (git commit -v)
grep -v '^#' "$1" > "$commit_msg"
sed -n -e '/^#/d' -e '/^diff --git/q' -e 'p;d' "$1" > "$commit_msg"
die() {
echo 'commit-msg hook failure' 1>&2
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment