[libcamera-devel] utils: hooks: pre-push: Catch commits without reviews

Message ID 20200429010601.32639-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit 49856afa01c36d7e41f3a1ed31d7437e7e01dcc8
Headers show
Series
  • [libcamera-devel] utils: hooks: pre-push: Catch commits without reviews
Related show

Commit Message

Laurent Pinchart April 29, 2020, 1:06 a.m. UTC
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>
---
 utils/hooks/pre-push | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Kieran Bingham April 29, 2020, 2 p.m. UTC | #1
Hi Laurent,

On 29/04/2020 02:06, Laurent Pinchart wrote:
> Improve the pre-push git hook script to reject commits without at least
> one Reviewed-by line.

I'm sure this "shouldn't" happen - but it's certainly a useful
validation check.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  utils/hooks/pre-push | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/utils/hooks/pre-push b/utils/hooks/pre-push
> index 0eb8f5ce193d..5dc8addabeb6 100755
> --- a/utils/hooks/pre-push
> +++ b/utils/hooks/pre-push
> @@ -56,6 +56,13 @@ do
>  			echo >&2 "Missing committer Signed-off-by in commit $commit"
>  			errors=$((errors+1))
>  		fi
> +
> +		# 3. A Reviewed-by is required.
> +		if ! echo "$msg" | grep -q '^Reviewed-by: '
> +		then
> +			echo >&2 "No Reviewed-by in commit $commit"
> +			errors=$((errors+1))
> +		fi
>  	done
>  
>  	if [ $errors != 0 ]
>

Patch

diff --git a/utils/hooks/pre-push b/utils/hooks/pre-push
index 0eb8f5ce193d..5dc8addabeb6 100755
--- a/utils/hooks/pre-push
+++ b/utils/hooks/pre-push
@@ -56,6 +56,13 @@  do
 			echo >&2 "Missing committer Signed-off-by in commit $commit"
 			errors=$((errors+1))
 		fi
+
+		# 3. A Reviewed-by is required.
+		if ! echo "$msg" | grep -q '^Reviewed-by: '
+		then
+			echo >&2 "No Reviewed-by in commit $commit"
+			errors=$((errors+1))
+		fi
 	done
 
 	if [ $errors != 0 ]