[libcamera-devel] utils: hooks: pre-push: Reject commits with a Change-Id
diff mbox series

Message ID 20201030013735.15603-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit 4757ff4ab7b4dac560cad26db12e28ef741c96ff
Headers show
Series
  • [libcamera-devel] utils: hooks: pre-push: Reject commits with a Change-Id
Related show

Commit Message

Laurent Pinchart Oct. 30, 2020, 1:37 a.m. UTC
We're not using gerrit, so let's prevent Change-Id tags creeping in
unadvertently.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 utils/hooks/pre-push | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Kieran Bingham Oct. 30, 2020, 9:29 a.m. UTC | #1
Hi Laurent,

On 30/10/2020 01:37, Laurent Pinchart wrote:
> We're not using gerrit, so let's prevent Change-Id tags creeping in
> unadvertently.
> 

s/unadvertently/inadvertently/

Has this happened?

It /almost/ happened to me, as I committed some code while working in
the repository checked out in CrOS, which installs the gerrit hooks.

I saw it and removed it, so to see this pop up 2 days later makes me
doubt myself - yet I can't see any Change-Id tags in our tree?

> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>


Anyway, - certainly - these can be caught and stripped out.

Reviewed-by: Kieran Bingham <kieran.bingham@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 2417d379db4c..d13e2c3b506c 100755
> --- a/utils/hooks/pre-push
> +++ b/utils/hooks/pre-push
> @@ -63,6 +63,13 @@ do
>  			echo >&2 "No Reviewed-by or Acked-by in commit $commit"
>  			errors=$((errors+1))
>  		fi
> +
> +		# 4. The commit message shall not contain a Change-Id.
> +		if echo "$msg" | grep -q '^Change-Id:'
> +		then
> +			echo >&2 "Found Change-Id in commit $commit"
> +			errors=$((errors+1))
> +		fi
>  	done
>  
>  	if [ $errors != 0 ]
>
Niklas Söderlund Oct. 30, 2020, 9:51 a.m. UTC | #2
Hi Laurent,

Thanks for your patch.

On 2020-10-30 03:37:35 +0200, Laurent Pinchart wrote:
> 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>

> ---
>  utils/hooks/pre-push | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/utils/hooks/pre-push b/utils/hooks/pre-push
> index 2417d379db4c..d13e2c3b506c 100755
> --- a/utils/hooks/pre-push
> +++ b/utils/hooks/pre-push
> @@ -63,6 +63,13 @@ do
>  			echo >&2 "No Reviewed-by or Acked-by in commit $commit"
>  			errors=$((errors+1))
>  		fi
> +
> +		# 4. The commit message shall not contain a Change-Id.
> +		if echo "$msg" | grep -q '^Change-Id:'
> +		then
> +			echo >&2 "Found Change-Id in commit $commit"
> +			errors=$((errors+1))
> +		fi
>  	done
>  
>  	if [ $errors != 0 ]
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Laurent Pinchart Oct. 30, 2020, 1:03 p.m. UTC | #3
Hi Kieran,

On Fri, Oct 30, 2020 at 09:29:01AM +0000, Kieran Bingham wrote:
> On 30/10/2020 01:37, Laurent Pinchart wrote:
> > We're not using gerrit, so let's prevent Change-Id tags creeping in
> > unadvertently.
> > 
> 
> s/unadvertently/inadvertently/
> 
> Has this happened?

git log will answer that question :-) It has happened once, in
b2b8c4dc941b979ddf5e9013530e76c67e6a12fe.

> It /almost/ happened to me, as I committed some code while working in
> the repository checked out in CrOS, which installs the gerrit hooks.
> 
> I saw it and removed it, so to see this pop up 2 days later makes me
> doubt myself - yet I can't see any Change-Id tags in our tree?
> 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> Anyway, - certainly - these can be caught and stripped out.
> 
> Reviewed-by: Kieran Bingham <kieran.bingham@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 2417d379db4c..d13e2c3b506c 100755
> > --- a/utils/hooks/pre-push
> > +++ b/utils/hooks/pre-push
> > @@ -63,6 +63,13 @@ do
> >  			echo >&2 "No Reviewed-by or Acked-by in commit $commit"
> >  			errors=$((errors+1))
> >  		fi
> > +
> > +		# 4. The commit message shall not contain a Change-Id.
> > +		if echo "$msg" | grep -q '^Change-Id:'
> > +		then
> > +			echo >&2 "Found Change-Id in commit $commit"
> > +			errors=$((errors+1))
> > +		fi
> >  	done
> >  
> >  	if [ $errors != 0 ]
Kieran Bingham Oct. 30, 2020, 1:27 p.m. UTC | #4
Hi Laurent,

On 30/10/2020 13:03, Laurent Pinchart wrote:
> Hi Kieran,
> 
> On Fri, Oct 30, 2020 at 09:29:01AM +0000, Kieran Bingham wrote:
>> On 30/10/2020 01:37, Laurent Pinchart wrote:
>>> We're not using gerrit, so let's prevent Change-Id tags creeping in
>>> unadvertently.
>>>
>>
>> s/unadvertently/inadvertently/
>>
>> Has this happened?
> 
> git log will answer that question :-) It has happened once, in
> b2b8c4dc941b979ddf5e9013530e76c67e6a12fe.
> 
>> It /almost/ happened to me, as I committed some code while working in
>> the repository checked out in CrOS, which installs the gerrit hooks.
>>
>> I saw it and removed it, so to see this pop up 2 days later makes me
>> doubt myself - yet I can't see any Change-Id tags in our tree?
>>

See I knew it would be me ;-)

--
Kieran


>>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>>
>> Anyway, - certainly - these can be caught and stripped out.
>>
>> Reviewed-by: Kieran Bingham <kieran.bingham@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 2417d379db4c..d13e2c3b506c 100755
>>> --- a/utils/hooks/pre-push
>>> +++ b/utils/hooks/pre-push
>>> @@ -63,6 +63,13 @@ do
>>>  			echo >&2 "No Reviewed-by or Acked-by in commit $commit"
>>>  			errors=$((errors+1))
>>>  		fi
>>> +
>>> +		# 4. The commit message shall not contain a Change-Id.
>>> +		if echo "$msg" | grep -q '^Change-Id:'
>>> +		then
>>> +			echo >&2 "Found Change-Id in commit $commit"
>>> +			errors=$((errors+1))
>>> +		fi
>>>  	done
>>>  
>>>  	if [ $errors != 0 ]
>

Patch
diff mbox series

diff --git a/utils/hooks/pre-push b/utils/hooks/pre-push
index 2417d379db4c..d13e2c3b506c 100755
--- a/utils/hooks/pre-push
+++ b/utils/hooks/pre-push
@@ -63,6 +63,13 @@  do
 			echo >&2 "No Reviewed-by or Acked-by in commit $commit"
 			errors=$((errors+1))
 		fi
+
+		# 4. The commit message shall not contain a Change-Id.
+		if echo "$msg" | grep -q '^Change-Id:'
+		then
+			echo >&2 "Found Change-Id in commit $commit"
+			errors=$((errors+1))
+		fi
 	done
 
 	if [ $errors != 0 ]