Commit graph

12 commits

Author SHA1 Message Date
Laurent Pinchart
fc761ffe49 hooks: pre-push: Verify that co-authors have a SoB line
The Co-developed-by tag must be followed by a corresponding SoB line.
Enforce this rule in the git pre-push hook.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-08 18:06:30 +03:00
Kieran Bingham
ffcd1b2804 hooks: pre-push: Disable interpretation of escape sequences
The pre-push hook validates the commit messages utilising 'echo' to send
the captured data from the git commit through grep.

Commit messages may occasionally contain strings that could appear to be
escape sequences such as doxygen style references to \struct.

The '\' 'c' escape sequence can be interpreted to supress all further
output [0] which then breaks the processing and string matching.

Unfortunatley for us, doxygen's class reference constructed in the same
form as \struct can be interpreted as the escape sequence to supress
further output.

[0] https://www.gnu.org/software/bash/manual/bash.html#Bash-Builtins

Update the pre-push hook to explicitly disable escape sequence
interpretation using the '-E' flag. This is not available on the
posix-compliant shell 'dash', so also switch to bash explicitly to
prevent potential failures.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09 15:39:04 +00:00
Laurent Pinchart
4efca856c0 utils: hooks: pre-push: Catch commits without author's SoB
The pre-push git hook script catches commits without a SoB line
corresponding to the committer, but doesn't perform the same check on
the author. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-03-28 13:29:32 +03:00
Laurent Pinchart
40d9947781 utils: hooks: pre-push: Check push to integration/* branches
Branches named integration/* are candidates for merge in the master
branch. Subject them to the same checks in the pre-push git hook.

An important difference between integration branches and the master
branch is that the former are typically created as new branches. We
can't check the whole history as there are known bad commits, so we have
to identify the base commit for the integration branch. The best
approximation is to use the remote master branch for the tree being
pushed to.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-10-19 13:14:54 +03:00
Laurent Pinchart
4757ff4ab7 utils: hooks: pre-push: Reject commits with a Change-Id
We're not using gerrit, so let's prevent Change-Id tags creeping in
unadvertently.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-11-02 01:03:31 +02:00
Laurent Pinchart
ef4bc8d101 utils: hooks: pre-push: Accept Acked-by in addition to Reviewed-by
Allow pushing commits that have no Reviewed-by tag but have at least one
Acked-by tag.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-10-02 15:30:14 +03:00
Laurent Pinchart
49856afa01 utils: hooks: pre-push: Catch commits without reviews
Improve the pre-push git hook script to reject commits without at least
one Reviewed-by line.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-30 00:43:09 +03:00
Laurent Pinchart
fcfbec801b utils: hooks: pre-push: Catch commits without committer's SoB
Improve the pre-push git hook script to reject commits without the
committer's Signed-off-by line.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-04-30 00:43:09 +03:00
Laurent Pinchart
606623dcb8 licenses: Add SPDX headers to the git commit hook scripts
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-15 19:51:56 +03:00
Laurent Pinchart
36ad4eb188 utils: hooks: Add pre-push commit hook
Add a pre-push commit hooks to prevent unintentional push of patches
containing local changelogs to the master branch.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-04-15 01:07:42 +03:00
Nicolas Dufresne
3628fb704b checkstyle: Add a pre-commit hook script
This adds support for pre-commit hook workflow. In pre-commit hook we
check the style on the changes currently staged or the combination
of the index and the last commit if "git commit --amend" is being used.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-01-18 22:41:00 +02:00
Kieran Bingham
3f82f50227 utils: hooks: Provide post-commit hook example to checkstyle.py
Provide an example post-commit hook which a developer can install, ensuring
that every commit gets the style checker executed on it.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-30 10:57:37 +00:00