Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Dec 2020 00:23:49 +0100
From:      Alexander Richardson <arichardson@freebsd.org>
To:        Ed Maste <emaste@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: b67e44075539 - main - Add comment explaining Git commit message hook
Message-ID:  <CA%2BZ_v8pC0Mxp1Tp==UeDKdroHgraKjH%2Bom8BR7SbamFDgLHX8Q@mail.gmail.com>
In-Reply-To: <202012301733.0BUHXUka053609@gitrepo.freebsd.org>
References:  <202012301733.0BUHXUka053609@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 30 Dec 2020 at 18:33, Ed Maste <emaste@freebsd.org> wrote:
>
> The branch main has been updated by emaste:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=b67e440755391b4a75363173ca16e170ccbf0394
>
> commit b67e440755391b4a75363173ca16e170ccbf0394
> Author:     Ed Maste <emaste@FreeBSD.org>
> AuthorDate: 2020-12-30 17:31:29 +0000
> Commit:     Ed Maste <emaste@FreeBSD.org>
> CommitDate: 2020-12-30 17:33:19 +0000
>
>     Add comment explaining Git commit message hook
>
>     Suggested by:   jhb
> ---
>  tools/tools/git/hooks/prepare-commit-msg | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/tools/tools/git/hooks/prepare-commit-msg b/tools/tools/git/hooks/prepare-commit-msg
> index 9dcb85cd1a3f..e453b73cc45d 100755
> --- a/tools/tools/git/hooks/prepare-commit-msg
> +++ b/tools/tools/git/hooks/prepare-commit-msg
> @@ -1,5 +1,13 @@
>  #!/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 copying into the git hooks directory - for example,
> +# cp tools/tools/git/hooks/prepare-commit-msg .git/hooks/
> +

Maybe suggest `ln -s ../../tools/tools/git/hooks/prepare-commit-msg
.git/hooks/` to ensure that future updates to the commit template
aren't lost?

Thanks,
Alex

>  case "$2" in
>  commit|message)
>         # It appears git invokes this script for interactive rebase but does
> @@ -21,7 +29,9 @@ outfile=$(mktemp /tmp/freebsd-git-commit.XXXXXXXX)
>  #
>  # 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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2BZ_v8pC0Mxp1Tp==UeDKdroHgraKjH%2Bom8BR7SbamFDgLHX8Q>