aboutsummaryrefslogtreecommitdiff
path: root/scripts/ci-checkpatches.sh
blob: 798efe05240835ccca30936468dbbc4e82e3bb55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash -x

PATCHES=$1
echo "Run checkpatch for ${PATCHES}"
# Generate patches provided with $1.
# In case of force push and range is broken
# validate only the latest commit if it's not merge commit.

if [ "$PATCHES" = "" ]; then
	git format-patch -1 HEAD;
	perl ./scripts/checkpatch.pl *.patch;
	exit $?
fi

git show --summary HEAD| grep -q '^Merge:';
if [ $? -ne 0 ]; then
	git format-patch -1 HEAD;
	perl ./scripts/checkpatch.pl *.patch;
	exit $?
fi

git format-patch ${PATCHES}
perl ./scripts/checkpatch.pl *.patch;