Skip to content

Run DCO checker with commit hooks #2281

@hausdorff

Description

@hausdorff

Title: Run DCO checker with commit hooks

Description:
CONTRIBUTING.md specifies that commits should contain a DCO signoff. It's easy to forget this, and a pain to rebase when you do commit.

A better option is to automatically signoff using git's commit hooks API.

Mesos uses the following workflow to support this across the entire contributor base:

  1. When you first clone the repository, you run bootstrap, a shell script in the project root.
  2. This (among other things) causes the git commit hooks in support/hooks to be copied into the user's local .git folder.
  3. Then, when the user attempts to commit, various checks and associated processing is done. (e.g., they run linters, formatters, validate the commit message, and so on).

The major gotcha to this approach is to have a graceful error path. In Mesos's approach, if you fail to format the commit message correctly, it will abort, and unless you know that your commit message is squirreled away in places like .git/COMMIT_EDITMSG, you might think you have to type it all over again. In this case I believe this can be avoided.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions