Skip to content

Commit 61a5ce1

Browse files
committed
lkl tools: codying style checks: fetch Linux upstream tags
Since upstream merge PR don't contains the upstream tags, the coding style checks will include upstream commits during merges with upstream. To avoid this we need to fetch the Linux upstream tags. To avoid using another env variable, we switch to using remote autodetection. NOTE: this requires that both upstream Linux and lkl remotes are already setup for the current repository. Signed-off-by: Octavian Purdila <tavi@cs.pub.ro>
1 parent beb1cad commit 61a5ce1

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

tools/lkl/scripts/checkpatch.sh

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh -e
1+
#!/bin/sh -ex
22

33
# Sometime we might want to skip certain checkpatch.pl errors
44
# (e.g. when trying to preserve existing code style that checkpatch.pl
@@ -13,18 +13,32 @@ if [ -z "$origin_master" ]; then
1313
origin_master="origin/master"
1414
fi
1515

16-
origin=$(dirname $origin_master)
17-
master=$(basename $origin_master)
16+
UPSTREAM=git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
17+
LKL=github.com:lkl/linux.git
1818

19-
# make sure we fetch to avoid caching effects
20-
git fetch --tags $origin +refs/heads/$master:refs/remotes/$origin/$master
19+
upstream=`git remote -v | grep $UPSTREAM | cut -f1 | head -n1`
20+
lkl=`git remote -v | grep $LKL | cut -f1 | head -n1`
21+
22+
if [ -z "$upstream" ]; then
23+
git fetch --tags --progress http://$UPSTREAM
24+
else
25+
git fetch --tags $upstream
26+
fi
27+
28+
if [ -z "$lkl" ]; then
29+
echo "can't find lkl remote, quiting"
30+
exit 1
31+
fi
32+
33+
git fetch $lkl
34+
git fetch --tags $upstream
2135

2236
# find the last upstream tag to avoid checking upstream commits during
2337
# upstream merges
2438
tag=`git tag --sort='-*authordate' | grep ^v | head -n1`
2539
tmp=`mktemp -d`
2640

27-
commits=$(git log --no-merges --pretty=format:%h HEAD ^$origin/$master ^$tag)
41+
commits=$(git log --no-merges --pretty=format:%h HEAD ^$lkl/master ^$tag)
2842
for c in $commits; do
2943
git format-patch -1 -o $tmp $c
3044
done

0 commit comments

Comments
 (0)