summaryrefslogtreecommitdiff
path: root/utils/hooks
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-03-26 19:41:55 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-03-28 13:29:32 +0300
commit4efca856c040ce78b08534a41190ae6c63326e04 (patch)
treef12b7e2bdfd4106afc097644c07e42ba7621e53b /utils/hooks
parent73490312944d5e81f2f7b81c8328f0fb1f74074e (diff)
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>
Diffstat (limited to 'utils/hooks')
-rwxr-xr-xutils/hooks/pre-push12
1 files changed, 10 insertions, 2 deletions
diff --git a/utils/hooks/pre-push b/utils/hooks/pre-push
index e4187f38..90ffdf6f 100755
--- a/utils/hooks/pre-push
+++ b/utils/hooks/pre-push
@@ -67,8 +67,8 @@ do
errors=$((errors+1))
fi
- # 2. The commit message shall have a Signed-off-by line
- # corresponding the committer.
+ # 2. The commit message shall have Signed-off-by lines
+ # corresponding the committer and the author.
committer=$(echo "$msg" | grep '^committer ' | head -1 | \
cut -d ' ' -f 2- | rev | cut -d ' ' -f 3- | rev)
if ! echo "$msg" | grep -F -q "Signed-off-by: ${committer}"
@@ -77,6 +77,14 @@ do
errors=$((errors+1))
fi
+ author=$(echo "$msg" | grep '^author ' | head -1 | \
+ cut -d ' ' -f 2- | rev | cut -d ' ' -f 3- | rev)
+ if ! echo "$msg" | grep -F -q "Signed-off-by: ${author}"
+ then
+ echo >&2 "Missing author Signed-off-by in commit $commit"
+ errors=$((errors+1))
+ fi
+
# 3. A Reviewed-by or Acked-by is required.
if ! echo "$msg" | grep -q '^\(Reviewed\|Acked\)-by: '
then