[libcamera-devel] [PATCH] utils: hooks: Provide post-commit hook example to checkstyle.py

Kieran Bingham kieran.bingham at ideasonboard.com
Wed Jan 23 15:15:47 CET 2019


Hi Laurent,

On 22/01/2019 23:32, Laurent Pinchart wrote:
> Hi Kieran,
> 
> Thank you for the patch.
> 
> On Tue, Jan 22, 2019 at 07:29:30PM +0000, Kieran Bingham wrote:
>> Provide an example post-commit hook which a developer can install, ensuring
>> that every commit gets the style checker executed on it.
>>
>> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
>> ---
>>  utils/hooks/post-commit | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>  create mode 100755 utils/hooks/post-commit
>>
>> diff --git a/utils/hooks/post-commit b/utils/hooks/post-commit
>> new file mode 100755
>> index 000000000000..e992428b11ae
>> --- /dev/null
>> +++ b/utils/hooks/post-commit
>> @@ -0,0 +1,11 @@
>> +#!/bin/sh
>> +
>> +# Execute the checkstyle script after committing any code.  This allows the
> 
> s/  / / or is it on purpose ?

That was done by vim's auto-formatter. <esc-gqip>

> 
>> +# commit to succeed, but ensures that the developer is aware of any potential
>> +# issues immediately, and can resolve them and fix rapidly with:
>> +#   git commit --amend
>> +#
>> +# To utilise this hook, install this file to:
>> +#   .git/hooks/post-commit
> 
> I would say
> 
> # To utilise this hook, install this file to:
> #   cp utils/hooks/post-commit .git/hooks/post-commit

what about 'ln -s' to keep updates?

'install this file to:' then doesn't flow... so perhaps it would have to
read

'install this file with:' or 'by':

But the point was - I was leaving this operation up to the user.


>> +
>> +./utils/checkstyle.py
> 
> Are hooks always run from the root of the tree if you run git commit
> from a subdirectory ? If not, I'm sure there's a way for the hook to the
> the base path.

The hook is executed from the root of the tree.

You can test by going into any sub-directory and creating a commit.
The hook will still successfully run.

> 
> With these issues addressed,
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>


-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list