Page MenuHomeFreeBSD

Initial version of git commit message preparation hook
ClosedPublic

Authored by emaste on Dec 16 2020, 4:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jun 28, 3:48 AM
Unknown Object (File)
Sun, Jun 16, 3:31 PM
Unknown Object (File)
Sun, Jun 16, 3:27 PM
Unknown Object (File)
May 19 2024, 4:19 PM
Unknown Object (File)
May 19 2024, 4:18 PM
Unknown Object (File)
May 15 2024, 11:35 PM
Unknown Object (File)
May 15 2024, 8:30 PM
Unknown Object (File)
Apr 12 2024, 8:39 AM

Details

Summary

Start with a very slightly modified version of the SVN commit template.
This should be updated to add parts of the default Git commit message
template (such as the '#' will be ignored, Date:, On branch <branch>,
Changes to be committed, etc.) and could be further updated to have a
corresponding commit-message hook that checks for invalid metadata, such
as uncommented but empty metadata fields.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

emaste created this revision.

Open for discussion as a starting point.

tools/tools/git/hooks/prepare-commit-msg
3–10 ↗(On Diff #80767)

Delete this comment

tools/tools/git/hooks/prepare-commit-msg
22 ↗(On Diff #80767)

In the Git WG we discussed changing these to follow the more typical (in the Git world) hyphenated approach - Submitted-by: etc.
Either way we should encourage anything parsing these (e.g. MFC reminder) accepts either form.

arichardson added inline comments.
tools/tools/git/hooks/prepare-commit-msg
22 ↗(On Diff #80767)

Since we are using git now, maybe we should suggest that patches submitted by other people set the commit author metadata instead of using submitted by metadata?

Do we want to also include Co-authored-by: in this list? This is parsed by github+gitlab and will be displayed in the UI.

Insert our template at the first empty (^#$) spot in the default git commit message

avoid splatting our help text into git rebase -i messages

Treat commit and message the same; the former is used for --amend

Re: hyphenated metadata attribute names — I'd just keep our annotations the same as they are now. If we were starting from scratch as a git project, sure, we should adopt the common git scheme. But the annotations are not special in git (just part of the commit message), and any FreeBSD tooling has to understand our previous annotations anyway.

In D27633#617808, @cem wrote:

But the annotations are not special in git (just part of the commit message), and any FreeBSD tooling has to understand our previous annotations anyway.

That's a fair point. We might adopt Signed-off-by: but anyway the general approach is to keep things as they are as much as possible in the first phase of the transition.

tools/tools/git/hooks/prepare-commit-msg
22 ↗(On Diff #80767)

Since we are using git now, maybe we should suggest that patches submitted by other people set the commit author metadata instead of using submitted by metadata?

Yes, we'll definitely want to start preserving author metadata and Submitted by will become uncommon.

Do we want to also include Co-authored-by: in this list? This is parsed by github+gitlab and will be displayed in the UI.

Yeah, we should.

I'd like to start with the trivial translation from the svn world, and have a history of the changes that we've made from svn->git

tools/tools/git/hooks/prepare-commit-msg
38 ↗(On Diff #80796)

Do we want this to be 72 instead of 76 now per your other doc?

50 ↗(On Diff #80796)

Do we want this to say something like "https://github.com/freebsd/<repo>/pull/###" to allow for the future freebsd-src.git mirror as well as freebsd-doc and freebsd-ports?

22 ↗(On Diff #80767)

We will still get patches via e-mail that aren't full-fledged git commits, and for those submitted by will still be relevant. I do think for full-fledged git commits from others, we will definitely use the existing metadata.

incorporate feedback from jhb

looks good, with spaces I'm happy.

This revision is now accepted and ready to land.Dec 17 2020, 7:08 PM