Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Dec 2020 17:29:15 -0500
From:      Ed Maste <emaste@freebsd.org>
To:        Alan Somers <asomers@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>,  svn-src-head <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r368736 - head/tools/tools/git/hooks
Message-ID:  <CAPyFy2DUNwDAdTR1hCYgx9HMJ_0gtw8yKpYULDMbYJvWoqSD3w@mail.gmail.com>
In-Reply-To: <CAOtMX2gtXVRv6i1iAUE25PLxiGt8SnecykXkfm252c=H2y-b7w@mail.gmail.com>
References:  <202012171958.0BHJwT9X079850@repo.freebsd.org> <CAOtMX2gtXVRv6i1iAUE25PLxiGt8SnecykXkfm252c=H2y-b7w@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 28 Dec 2020 at 14:34, Alan Somers <asomers@freebsd.org> wrote:
>
> On Thu, Dec 17, 2020 at 12:58 PM Ed Maste <emaste@freebsd.org> wrote:
>>
>> 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
>>
> Thanks!  But how can we use it?  Is there a "git config" incantation that will use this file?

Just copy it into .git/hooks/. Can also fetch the latest version
directly from cgit; lwhsu added this to
https://github.com/bsdimp/freebsd-git-docs/blob/main/URLs.md:

fetch https://cgit.freebsd.org/src/plain/tools/tools/git/hooks/prepare-commit-msg
-o .git/hooks
chmod 755 .git/hooks/prepare-commit-msg

I'd like us to end up with a setup-repo.sh or such that will offer to
take care of all of these things.

>Also, this seems too complicated.  Git already has a "config.template" configuration variable.   Could we just use that instead, or does it not work for some reason?

It does work, although it's a bit awkward. For one thing, the provided
template is placed at the top of the message, followed by the default
message, but our addition is really commented-out information and fits
best in the middle of the existing text - after the "Please enter
the..." and before the list of changes and such. With config.template
we'd end up with something like:

====

# PR:           <If and which Problem Report is related.>
# ...
# Differential Revision:        <https://reviews.freebsd.org/D###>;
#
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# ...
====

Additionally we might want to make some more programmatic changes in
the default message (depending on the resolution of some open
questions). For example we could strip the "MFC after" line that's
copied from the original commit, when preparing the commit message for
a MFC/cherry-pick.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPyFy2DUNwDAdTR1hCYgx9HMJ_0gtw8yKpYULDMbYJvWoqSD3w>