svn commit: r368736 - head/tools/tools/git/hooks

Ed Maste emaste at FreeBSD.org
Thu Dec 17 19:58:30 UTC 2020


Author: emaste
Date: Thu Dec 17 19:58:29 2020
New Revision: 368736
URL: https://svnweb.freebsd.org/changeset/base/368736

Log:
  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

Added:
  head/tools/tools/git/hooks/
  head/tools/tools/git/hooks/prepare-commit-msg   (contents, props changed)

Added: head/tools/tools/git/hooks/prepare-commit-msg
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/git/hooks/prepare-commit-msg	Thu Dec 17 19:58:29 2020	(r368736)
@@ -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


More information about the svn-src-head mailing list