#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# contrib/git-hooks/prepare-commit-msg
#
# A Git hook script to prepare the commit log message. Install into
# lustre/.git/hooks/prepare-commit-msg to enable for Lustre commits.
# 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=${CHECKPATCH:-contrib/scripts/checkpatch.pl}
CHECKPATCH_OPTS=${CHECKPATCH_OPTS:-"--no-signoff --no-tree"}
# this shouldn't be adding new comments, or they appear in the commit.
grep -q "^#" "$1" || exit 0
+# Add a commented-out Test-Parameters: line. This will let the developer
+# uncomment it out if they think it's appropriate.
+echo "#" >> "$1"
+echo "# If this patch makes only non-functional changes, or test-only" >> "$1"
+echo "# changes, consider adding this 'Test-Parameters' in the" >> "$1"
+echo "# commit message:" >> "$1"
+echo "#" >> "$1"
+echo "# Test-Parameters: trivial" >> "$1"
+echo "#" >> "$1"
+echo "# If you need to repeat the same subtest many times, consider" >> "$1"
+echo "# this instead:" >> "$1"
+echo "#" >> "$1"
+echo "# Test-Parameters: trivial testlist=sanity env=ONLY=1,ONLY_REPEAT=100" >> "$1"
+echo "#" >> "$1"
+echo "# https://wiki.whamcloud.com/display/PUB/Changing+Test+Parameters+with+Gerrit+Commit+Messages" >> "$1"
+echo "#" >> "$1"
+
# 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.
# The developer should uncomment it to include it in the commit message.
+echo "#" >> "$1"
+echo "# The 'Signed-off-by' line signifies that you agree to the Developer" >> "$1"
+echo "# Certificate of Origin - https://developercertificate.org/" >> "$1"
+echo "#" >> "$1"
SIGNOFF=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
grep -qs "^$SIGNOFF" "$1" || echo "# $SIGNOFF" >> "$1"