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>
This commit is contained in:
Laurent Pinchart 2024-10-07 22:11:34 +03:00
parent b20dfa95d2
commit fc761ffe49

View file

@ -68,7 +68,7 @@ do
fi fi
# 2. The commit message shall have Signed-off-by lines # 2. The commit message shall have Signed-off-by lines
# corresponding the committer and the author. # corresponding the committer, author, and all co-developers.
committer=$(echo "$msg" | grep '^committer ' | head -1 | \ committer=$(echo "$msg" | grep '^committer ' | head -1 | \
cut -d ' ' -f 2- | rev | cut -d ' ' -f 3- | rev) cut -d ' ' -f 2- | rev | cut -d ' ' -f 3- | rev)
if ! echo -E "$msg" | grep -F -q "Signed-off-by: ${committer}" if ! echo -E "$msg" | grep -F -q "Signed-off-by: ${committer}"
@ -85,6 +85,15 @@ do
errors=$((errors+1)) errors=$((errors+1))
fi fi
while read -r codev
do
if ! echo -E "$msg" | grep -F -q "Signed-off-by: ${codev}"
then
echo >&2 "Missing co-developer '${codev}' Signed-off-by in commit $commit"
errors=$((errors+1))
fi
done < <(echo "$msg" | grep '^Co-developed-by: ' | cut -d ' ' -f 2-)
# 3. A Reviewed-by or Acked-by is required. # 3. A Reviewed-by or Acked-by is required.
if ! echo -E "$msg" | grep -q '^\(Reviewed\|Acked\)-by: ' if ! echo -E "$msg" | grep -q '^\(Reviewed\|Acked\)-by: '
then then