aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2020-12-17 19:58:29 +0000
committerEd Maste <emaste@FreeBSD.org>2020-12-17 19:58:29 +0000
commit9f13adee8b848185269d107290fdfc940ed15636 (patch)
treedac88af63aa1e45b43f5f775287f3f0b76b3cf4a /tools
parent551e205f6dfa469f4f32a166ee3fb691201d27a7 (diff)
downloadsrc-9f13adee8b848185269d107290fdfc940ed15636.tar.gz
src-9f13adee8b848185269d107290fdfc940ed15636.zip
Add initial version of git commit message preparation hook
Start with a slightly modified version of the SVN commit template, to allow developers to experiment. This will be updated in the future as our process and techniques evolve. This can be installed by copying or symlinking into the .git/hooks/ directory. Feedback from: cem, jhb Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27633
Notes
Notes: svn path=/head/; revision=368736
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/git/hooks/prepare-commit-msg55
1 files changed, 55 insertions, 0 deletions
diff --git a/tools/tools/git/hooks/prepare-commit-msg b/tools/tools/git/hooks/prepare-commit-msg
new file mode 100644
index 000000000000..2da681db5599
--- /dev/null
+++ b/tools/tools/git/hooks/prepare-commit-msg
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+case "$2" in
+commit|message)
+ # It appears git invokes this script for interactive rebase but does
+ # not remove commented lines, so just exit if we're not called with the
+ # default (comment-containing) template.
+ egrep -q '^#' "$1" || return 0
+ ;;
+template)
+ return 0
+ ;;
+merge)
+ return 0
+ ;;
+esac
+
+outfile=$(mktemp /tmp/freebsd-git-commit.XXXXXXXX)
+cat >$outfile <<EOF
+
+$(awk '1;/^#$/{exit}' $1)
+# Uncomment and complete these metadata fields, as appropriate:
+#
+# PR:
+# Submitted by:
+# Reported by:
+# Reviewed by:
+# Approved by:
+# Obtained from:
+# MFC after:
+# MFH:
+# Relnotes:
+# Security:
+# Sponsored by:
+# Pull Request:
+# Differential Revision:
+#
+# Description of fields to fill in above: 72 columns --|
+# PR: If and which Problem Report is related.
+# Submitted by: If someone else sent in the change.
+# Reported by: If someone else reported the issue.
+# Reviewed by: If someone else reviewed your modification.
+# Approved by: If you needed approval for this commit.
+# Obtained from: If the change is from a third party.
+# MFC after: N [day[s]|week[s]|month[s]]. Request a reminder email.
+# MFH: Ports tree branch name. Request approval for merge.
+# Relnotes: Set to 'yes' for mention in release notes.
+# Security: Vulnerability reference (one per line) or description.
+# Sponsored by: If the change was sponsored by an organization.
+# Pull Request: https://github.com/freebsd/<repo>/pull/### (*full* GitHub URL needed).
+# Differential Revision: https://reviews.freebsd.org/D### (*full* phabric URL needed).
+$(awk '/^#$/,EOF' $1)
+EOF
+
+mv $outfile $1