From nobody Tue Aug 16 13:33:32 2022 X-Original-To: dev-commits-doc-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M6XCx1PM1z4Z7Q0 for ; Tue, 16 Aug 2022 13:33:33 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M6XCx0FWhz4QKN; Tue, 16 Aug 2022 13:33:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660656813; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qGf1ha148bJpErrN9dKwd/YBZWyJ09H/Kp05SeRoHgI=; b=O+GQwHVTM1eGDO3hlKfJzW+xrmoKeGXovspsxNkMzgGEnkpW1ItHYlmCR92Ylv/ol2qtMh vwm3/edyFnKxhgKSDiif7Fw3l1gZs253PGzsYLyFVOwSnfYSVvMfeFY3wph2Dv0iBwZ7kz Whe9T9GKBM8arOXmykBYTlXWybh5/JfRNQOdyDINhNreGP6kBF8GDYo3udV8lNevh26e6S GeHsucKvnYl9g/VfKytKscmlLCgPO4thIeNmwX+/IxD/y4JVzFWmAhUEtJ1KBYK8mSgdcQ MFJAkOoVvdc4i5za86nsi6fGBGkvE7CO7ZJ8QbXgWY46CHXyXDQxuTco+jSqNA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4M6XCw6R2mz19xm; Tue, 16 Aug 2022 13:33:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27GDXW5w019185; Tue, 16 Aug 2022 13:33:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27GDXWCe019184; Tue, 16 Aug 2022 13:33:32 GMT (envelope-from git) Date: Tue, 16 Aug 2022 13:33:32 GMT Message-Id: <202208161333.27GDXWCe019184@gitrepo.freebsd.org> To: doc-committers@FreeBSD.org, dev-commits-doc-all@FreeBSD.org From: Li-Wen Hsu Subject: git: 4426b60c97 - main - Add the prepare-commit-msg hook to the repository List-Id: Commit messages for all branches of the doc repository List-Archive: https://lists.freebsd.org/archives/dev-commits-doc-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-doc-all@freebsd.org X-BeenThere: dev-commits-doc-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: doc X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4426b60c97365a0095d5ac8e6e946d51319c04f7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660656813; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qGf1ha148bJpErrN9dKwd/YBZWyJ09H/Kp05SeRoHgI=; b=meGJlH/idE/ZR51yEV7QSTVVvmeYI6pfFha2uB6IJV/pp42ecjUJgbTdnhgitKsw+XCTzj Tl2RGsAM/nFBW9aTwpPJZP0MY46qx1LOdp4iqabkranXbXR1R65YkfVX6tSkBO0tDezN0M O9UyqRAMbJhg+Lrw0YXeY87LDuF7Co7/+Bdo7yPQP4CYlkIKh2OLkBYmbbKiDhq3hHi0h2 pb6VastdvS82eQdO6Hy3n6azH1SXLHYmCE3MyJNZZuz59GjHmhJSwKlb9IIp5cCNZ4TNA+ cvTJWnh94KFmsfbRTZmLDdiSLKgp0/1Fu+Bh7oehEGbYjkBlqri4Dbhq8ho21g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660656813; a=rsa-sha256; cv=none; b=ibVRD7hCpM939WW602F23WWlgdpXMU3wemg/hk+xcN7PidiizVZaIzsO/9gk1Rg/zv2ph2 cTHaygTzRLK4q8+om1A68Rdb9ue+dW8jWEfIYjtDVBoOb2oydIDfBlEV9JdNHilMbtIX93 TD7Nsn+2apEHiwnxEEJZarYrfdYA2iLvrFHyVToVA90ikewopotFl8SSksre+li8gqZx8h tVaedq/TY414I2i/KRtVfUPhBRk6Uriq+uqJ2300fQAa4/ZXZSr0lvinPytMCnf6gy/VO5 mzeWsiz309FPmVL8y2huTU388R06uRhPot1MlyhvKpemU6F7bzD3VHuYeYOM7A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/doc/commit/?id=4426b60c97365a0095d5ac8e6e946d51319c04f7 commit 4426b60c97365a0095d5ac8e6e946d51319c04f7 Author: Li-Wen Hsu AuthorDate: 2022-08-16 13:33:25 +0000 Commit: Li-Wen Hsu CommitDate: 2022-08-16 13:33:25 +0000 Add the prepare-commit-msg hook to the repository This is a merged and modified version from src and ports repositories. The easiest way to install is run the following command in the repository: git config --add core.hooksPath .hooks or copy it to the hooks directory, but it will not get automatically updated: cp .hooks/prepare-commit-msg .git/hooks/ Approved by: carlavilla (doceng) Differential Revision: https://reviews.freebsd.org/D36203 --- .hooks/prepare-commit-msg | 75 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/.hooks/prepare-commit-msg b/.hooks/prepare-commit-msg new file mode 100755 index 0000000000..aec38c7d06 --- /dev/null +++ b/.hooks/prepare-commit-msg @@ -0,0 +1,75 @@ +#!/bin/sh + +# prepare-commit-msg: Prepare a commit message upon `git commit` for the +# user to edit. A script (rather than a static template) is used, so +# that we can insert our template text other than at the top of the +# message. +# +# Install by either setting the configuration of the repository to: +# git config --add core.hooksPath .hooks +# or copy it to the hooks directory, but it will not get automatically updated: +# cp .hooks/prepare-commit-msg .git/hooks/ + +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. + grep -E -q '^#' "$1" || exit 0 + ;; +template) + exit 0 + ;; +merge) + exit 0 + ;; +esac + +outfile=$(mktemp /tmp/freebsd-git-commit.XXXXXXXX) +exec 3> "$outfile" + +# Create a commit message template from three parts: +# +# 1. The beginning of the git-provided template (up to the first comment-only +# line) which explains commented lines and such. +# +# 2. Our template. +# +# 3. The remainder of the git-provided template (from the first comment-only +# line to the end of the file) which lists files staged for commit, files +# not staged, and untracked files. + +awk '1;/^#$/{exit}' "$1" >&3 + +cat >&3 <: Subject goes here, max 50 cols --| +# +# 72 columns --| +# +# Do not add a "Submitted by:" line. If someone besides the committer sent in +# the change, the commit author should be set using \`git commit --author\`. +# +# Uncomment and complete these metadata fields, as appropriate: +# +# PR: +# Reported by: +# Reviewed by: +# Tested by: +# Approved by: +# Obtained from: +# Fixes: +# Relnotes: +# Security: +# Sponsored by: +# Pull Request: +# Differential Revision: +# +# "Pull Request" and "Differential Revision" require the *full* GitHub or +# Phabricator URL. +EOF + +awk '/^#$/,EOF' "$1" >&3 + +exec 3>&- + +mv "$outfile" "$1"