From owner-svn-src-head@freebsd.org Thu Dec 17 19:58:30 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A4444C26CF; Thu, 17 Dec 2020 19:58:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CxjVG0js9z4gxD; Thu, 17 Dec 2020 19:58:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B91A1E35A; Thu, 17 Dec 2020 19:58:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0BHJwT6F079851; Thu, 17 Dec 2020 19:58:29 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0BHJwT9X079850; Thu, 17 Dec 2020 19:58:29 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202012171958.0BHJwT9X079850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 17 Dec 2020 19:58:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368736 - head/tools/tools/git/hooks X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/tools/tools/git/hooks X-SVN-Commit-Revision: 368736 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Dec 2020 19:58:30 -0000 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 </pull/### (*full* GitHub URL needed). +# Differential Revision: https://reviews.freebsd.org/D### (*full* phabric URL needed). +$(awk '/^#$/,EOF' $1) +EOF + +mv $outfile $1