From 9f13adee8b848185269d107290fdfc940ed15636 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Thu, 17 Dec 2020 19:58:29 +0000 Subject: [PATCH] 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 --- tools/tools/git/hooks/prepare-commit-msg | 55 ++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 tools/tools/git/hooks/prepare-commit-msg diff --git a/tools/tools/git/hooks/prepare-commit-msg b/tools/tools/git/hooks/prepare-commit-msg new file mode 100644 index 00000000000..2da681db559 --- /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 </pull/### (*full* GitHub URL needed). +# Differential Revision: https://reviews.freebsd.org/D### (*full* phabric URL needed). +$(awk '/^#$/,EOF' $1) +EOF + +mv $outfile $1 -- 2.45.0