1#!/bin/sh 2 3case "$2" in 4commit|message) 5 # It appears git invokes this script for interactive rebase but does 6 # not remove commented lines, so just exit if we're not called with the 7 # default (comment-containing) template. 8 egrep -q '^#' "$1" || return 0 9 ;; 10template) 11 return 0 12 ;; 13merge) 14 return 0 15 ;; 16esac 17 18outfile=$(mktemp /tmp/freebsd-git-commit.XXXXXXXX) 19 20# Create a commit message template from three parts: 21# 22# 1. The beginning of the git-provided template (up to the first comment-only 23# line) which explains commented lines and such. 24# 2. Our template. 25# 3. The remainder of the git-provided template (from the first comment-only 26# line to the end of the file) which lists files staged for commit, files 27# not staged, and untracked files. 28 29cat >$outfile <<EOF 30$(awk '1;/^#$/{exit}' $1) 31# Uncomment and complete these metadata fields, as appropriate: 32# 33# PR: 34# Submitted by: 35# Reported by: 36# Reviewed by: 37# Approved by: 38# Obtained from: 39# MFC after: 40# MFH: 41# Relnotes: 42# Security: 43# Sponsored by: 44# Pull Request: 45# Differential Revision: 46# 47# Description of fields to fill in above: 72 columns --| 48# PR: If and which Problem Report is related. 49# Submitted by: If someone else sent in the change. 50# Reported by: If someone else reported the issue. 51# Reviewed by: If someone else reviewed your modification. 52# Approved by: If you needed approval for this commit. 53# Obtained from: If the change is from a third party. 54# MFC after: N [day[s]|week[s]|month[s]]. Request a reminder email. 55# MFH: Ports tree branch name. Request approval for merge. 56# Relnotes: Set to 'yes' for mention in release notes. 57# Security: Vulnerability reference (one per line) or description. 58# Sponsored by: If the change was sponsored by an organization. 59# Pull Request: https://github.com/freebsd/<repo>/pull/### (*full* GitHub URL needed). 60# Differential Revision: https://reviews.freebsd.org/D### (*full* phabric URL needed). 61$(awk '/^#$/,EOF' $1) 62EOF 63 64mv $outfile $1 65