Running checkpatch in pre-commit hook could be a constraint for day to day work. Though, running it before pushing to zephyr repo is highly recommended. Add a series push script callable from pre-push hook. Document how to use it in contribute section. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
37 lines
664 B
Bash
Executable file
37 lines
664 B
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Copyright (c) 2019 Linaro Limited
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
remote=$1
|
|
url=$2
|
|
local_ref=$3
|
|
local_sha=$4
|
|
remote_ref=$5
|
|
remote_sha=$6
|
|
z40=0000000000000000000000000000000000000000
|
|
|
|
set -e exec
|
|
|
|
echo "Run push "
|
|
|
|
if [ "$local_sha" = $z40 ]
|
|
then
|
|
# Handle delete
|
|
:
|
|
else
|
|
if [ "$remote_sha" = $z40 ]
|
|
then
|
|
# New branch, examine all commits since $remote/master
|
|
base_commit=`git rev-parse $remote/master`
|
|
range="$base_commit..$local_sha"
|
|
else
|
|
# Update to existing branch, examine new commits
|
|
range="$remote_sha..$local_sha"
|
|
fi
|
|
|
|
echo "Perform check patch"
|
|
/local/mcu/zephyr/zephyr-project/scripts/checkpatch.pl --git $range
|
|
fi
|