git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Automatic validation for commit messages


I've updated the subject to match the actual content

Francis>I feel that a git hook would probably still be the easiest and
simplest
Francis>way to get started

1) Just in case: I guess we need to confine automatic validation for
"master" branch only (or alike).

For instance, I tend to create tons of oops/fixup/t/tmp commits, and I
don't really want for the validator to blame me on each and every commit.
Ideally, it would validate only for "on push to apache.../master" (and/or
on commit to "local master branch")

2) Starting from Git 2.9, hook location could be configured via
core.hooksPath (see https://git-scm.com/docs/githooks ), so I guess we
would be fine if we just add the hooks to .githooks folder + a command to
activate it.
It's not clear if we should try to activate the hooks automatically (e.g.
at mvn validate or something like that), however we could do that for
Travis and it could produce decent coverage.

PS. They say, Git on Windows executes hooks via its own bash, so the hooks
should just work: https://stackoverflow.com/a/18278072/1261287

Vladimir