X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=build%2Fprepare-commit-msg;h=95266394e4d6673a120d166f0004913f5af09b35;hp=ae644eba2eaabaa4daf21bf7dca8ba1a8d295671;hb=490bb7a658d6d7a3608633b7416a6cf09e0d225b;hpb=0b554ff27b7cd282694a9d33728f2e48a10372f3;ds=sidebyside diff --git a/build/prepare-commit-msg b/build/prepare-commit-msg deleted file mode 100755 index ae644eb..0000000 --- a/build/prepare-commit-msg +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# -# A Git hook script to prepare the commit log message. Install into -# lustre/.git/hooks/prepare-commit-msg to enable for Lustre commits. -# -# Called by git-commit with the name of the file that has the -# commit message, followed by the description of the commit -# message's source. The hook's purpose is to edit the commit -# message file. If the hook fails with a non-zero status, -# the commit is aborted. -# -# Commit hook to check the patch against the Lustre coding style. -# It adds any checkpatch warnings/errors as commit comments, which -# means that they can currently be ignored, but are at least visible. - -CHECKPATCH=build/checkpatch.pl -CHECKPATCH_OPTS="--no-signoff --no-tree" -[ -r "$CHECKPATCH" ] || exit 0 - -# If there are no comments in the commit, it is likely a rebase and -# this shouldn't be adding new comments, or they appear in the commit. -grep -q "^#" "$1" || exit 0 - -# Add a commented-out Signed-off-by: line. This shouldn't be added in an -# uncommented form, otherwise sanity checking for an emtpy commit fails. -SIGNOFF=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') -grep -qs "^$SIGNOFF" "$1" || echo "# $SIGNOFF" >> "$1" - -# Add the checkpatch.pl output as comments, but don't cause a commit error -# yet, until there is more certainty that it is working correctly. -echo "" >> "$1" -echo "#" >> "$1" -git diff --cached | $CHECKPATCH $CHECKPATCH_OPTS - | sed -e 's/^/# /' >> "$1" diff --git a/build/prepare-commit-msg b/build/prepare-commit-msg new file mode 120000 index 0000000..9526639 --- /dev/null +++ b/build/prepare-commit-msg @@ -0,0 +1 @@ +../contrib/git-hooks/prepare-commit-msg \ No newline at end of file