[libcamera-devel] utils: hooks: pre-push: Catch commits without author's SoB
diff mbox series

Message ID 20220326174639.32199-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit 4efca856c040ce78b08534a41190ae6c63326e04
Headers show
Series
  • [libcamera-devel] utils: hooks: pre-push: Catch commits without author's SoB
Related show

Commit Message

Laurent Pinchart March 26, 2022, 5:46 p.m. UTC
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>
---
 utils/hooks/pre-push | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Comments

Kieran Bingham March 26, 2022, 10:45 p.m. UTC | #1
Quoting Laurent Pinchart via libcamera-devel (2022-03-26 17:46:39)
> 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.

Does this check and validate/prevent the mailing list name issue? I.e.
is this matching the entire of the 'From:' against the Author: to match
the full name and e-mail precisely? or is it only checking the name? (In
fact, that's sufficient to prevent last weeks mishap anyway so:


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

> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  utils/hooks/pre-push | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/utils/hooks/pre-push b/utils/hooks/pre-push
> index e4187f381a43..90ffdf6f1755 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
> -- 
> Regards,
> 
> Laurent Pinchart
>
Laurent Pinchart March 27, 2022, 1:37 a.m. UTC | #2
On Sat, Mar 26, 2022 at 10:45:31PM +0000, Kieran Bingham wrote:
> Quoting Laurent Pinchart via libcamera-devel (2022-03-26 17:46:39)
> > 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.
> 
> Does this check and validate/prevent the mailing list name issue? I.e.
> is this matching the entire of the 'From:' against the Author: to match
> the full name and e-mail precisely? or is it only checking the name? (In
> fact, that's sufficient to prevent last weeks mishap anyway so:

Yes, it matches the name and e-mail address, and will thus prevent the
"via libcamera-devel" authorship issue.

> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  utils/hooks/pre-push | 12 ++++++++++--
> >  1 file changed, 10 insertions(+), 2 deletions(-)
> > 
> > diff --git a/utils/hooks/pre-push b/utils/hooks/pre-push
> > index e4187f381a43..90ffdf6f1755 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

Patch
diff mbox series

diff --git a/utils/hooks/pre-push b/utils/hooks/pre-push
index e4187f381a43..90ffdf6f1755 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