On 6/19/26 9:44 AM, Dumitru Ceara via dev wrote:
> The pre-push example hook was suggesting the usage of:
> 
>   checkpatch.py -1 $sha
> 
> That is incorrect, checkpatch.py will then only check the last commit on
> the current branch, i.e., only the "-1" argument is enforced.  Moreover,
> `checkpatch.py $sha` is also wrong, it would fail with:
> 
>   ERROR: Unable to parse file '<SHA>'. Is it a patch?
> 
> A better way seems to be:
> 
>   git format-patch -1 --stdout $sha | checkpatch.py

This one is also not bulletproof.  The format-patch with the
default pretty format wraps the subject lines messing up the
subject line checks.  We'll need to add the format string to
make that work properly or enhance the checkpatch itself to
accept sha.

We also need to call ./utilities/checkpatch.py instead of plain
checkpatch.py, AFAIU.

Best regards, Ilya Maximets.

> 
> Update the docs to reflect that.
> 
> Signed-off-by: Dumitru Ceara <[email protected]>
> ---
>  Documentation/internals/committer-responsibilities.rst | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Documentation/internals/committer-responsibilities.rst 
> b/Documentation/internals/committer-responsibilities.rst
> index eed2e017678a..63acec42f8ae 100644
> --- a/Documentation/internals/committer-responsibilities.rst
> +++ b/Documentation/internals/committer-responsibilities.rst
> @@ -125,7 +125,7 @@ in your ``.git`` directory and make sure to mark it as 
> executable with
>                    n=$(expr $n + 1)
>                    git log -1 $sha
>                    echo
> -                  checkpatch.py -1 $sha
> +                  git format-patch -1 --stdout $sha | checkpatch.py
>                done <<EOF
>    $(git --no-pager log --pretty=%H $local_sha1...$remote_sha1)
>    EOF

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to